computerjazz / react-native-infinite-pager

An infinitely-swipeable pager component.
MIT License
175 stars 16 forks source link

No animation in iterativeAPI #11

Open SumitLubal opened 2 years ago

SumitLubal commented 2 years ago

I am loving this library and for our project it is very improtant to have iterative api usage for those with accessibility so they can touch instead of drag. incrementPage works beautifully but doesn't show any animation in scrolling. Any idea how we can add this?

nicolaosm commented 10 months ago

Any updates on this? Cant use the lib without it. Thanks

levymetal commented 3 months ago

This can be achieved by setting animated: true in the optional options arg. For example:

const App = () => {
  const pagerRef = useRef<InfinitePagerImperativeApi>(null);

  const incrementPage = () => {
    pagerRef.current?.incrementPage({animated: true})
  }

  const setPage = (index: number) => {
    pagerRef.current?.setPage(index, {animated: true})
  }

  return (
    <Pager ref={pagerRef} renderPage={() => <View />} />
  );
}