I'm using framer to render data gotten from an API in slides on the front end but i'm having an issue with the dragConstraints, It won't slide through to the end.
const [width, setWidth] = React.useState(0)
const carousel = useRef()
React.useEffect(() =>{
// calculates the min and max width for horizontal scroll.
setWidth(carousel.current.scrollWidth - carousel.current.offsetWidth)
},[])
<section className='search-body'>
{displaySearchText ? <p className='result-text'>Your search results</p> : ''}
{/* library to display search result in an horizontal scroll*/}
<motion.div ref={carousel} className='carousel'>
<motion.div drag='x' dragConstraints={{right:0, left:-width}} className='inner-carousel'>
{moveEl}
</motion.div>
</motion.div>
</section>