Skip to content

Commit

Permalink
fix: fix calculation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
dohooo committed Sep 7, 2021
1 parent d4c04d9 commit 15b2119
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ function Carousel<T extends unknown = any>(
}, [_data]);
const computedAnimResult = useComputedAnim(width, data.length);
const { next, prev } = useCarouselController({ width, handlerOffsetX });
const offsetX = useDerivedValue(
() => handlerOffsetX.value % computedAnimResult.WL,
[]
);
const offsetX = useDerivedValue(() => {
const x = handlerOffsetX.value % computedAnimResult.WL;
return isNaN(x) ? 0 : x;
}, []);
const animatedListScrollHandler =
useAnimatedGestureHandler<PanGestureHandlerGestureEvent>({
onStart: (_, ctx: any) => {
Expand Down

0 comments on commit 15b2119

Please sign in to comment.