diff --git a/src/Carousel.tsx b/src/Carousel.tsx index a0ac532e..20bc8cb4 100644 --- a/src/Carousel.tsx +++ b/src/Carousel.tsx @@ -135,7 +135,7 @@ function Carousel( const offsetX = useDerivedValue(() => { const x = handlerOffsetX.value % computedAnimResult.WL; return isNaN(x) ? 0 : x; - }, []); + }, [computedAnimResult]); const animatedListScrollHandler = useAnimatedGestureHandler( @@ -153,7 +153,7 @@ function Carousel( handlerOffsetX.value = Math.max( Math.min( ctx.startContentOffsetX + - Math.round(e.translationX), + Math.round(e.translationX), 0 ), -(data.length - 1) * width @@ -207,7 +207,7 @@ function Carousel( } }, }, - [loop] + [loop, data] ); React.useImperativeHandle(ref, () => {