Skip to content

Commit

Permalink
fix: after data props update carousel not be can swipe
Browse files Browse the repository at this point in the history
  • Loading branch information
dohooo committed Sep 8, 2021
1 parent 316e0a5 commit dd00932
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ function Carousel<T extends unknown = any>(
const offsetX = useDerivedValue(() => {
const x = handlerOffsetX.value % computedAnimResult.WL;
return isNaN(x) ? 0 : x;
}, []);
}, [computedAnimResult]);

const animatedListScrollHandler =
useAnimatedGestureHandler<PanGestureHandlerGestureEvent>(
Expand All @@ -153,7 +153,7 @@ function Carousel<T extends unknown = any>(
handlerOffsetX.value = Math.max(
Math.min(
ctx.startContentOffsetX +
Math.round(e.translationX),
Math.round(e.translationX),
0
),
-(data.length - 1) * width
Expand Down Expand Up @@ -207,7 +207,7 @@ function Carousel<T extends unknown = any>(
}
},
},
[loop]
[loop, data]
);

React.useImperativeHandle(ref, () => {
Expand Down

0 comments on commit dd00932

Please sign in to comment.