Skip to content

Commit

Permalink
fix: defaultIndex does not work as expected
Browse files Browse the repository at this point in the history
Fixes #33
  • Loading branch information
dohooo committed Nov 27, 2021
1 parent 0048d22 commit 42e4616
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ function Carousel<T extends unknown = any>(
...props.springConfig,
};
const width = Math.round(props.width);
const handlerOffsetX = useSharedValue<number>(defaultIndex * width);
const defaultHandlerOffsetX = -Math.abs(defaultIndex * width);
const handlerOffsetX = useSharedValue<number>(defaultHandlerOffsetX);
const data = React.useMemo<T[]>(() => {
if (!loop) return _data;

Expand Down

0 comments on commit 42e4616

Please sign in to comment.