Skip to content

Commit

Permalink
Listen for changes in data for autoplay to work (#126)
Browse files Browse the repository at this point in the history
* fix: autoplay not working

* fix: changed state sub from _data to _data.length

Co-authored-by: sofiaringstrom <[email protected]>
  • Loading branch information
sofiaringstrom and sofiaringstrom authored Sep 24, 2021
1 parent 929e0d6 commit 94a415d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/SwiperFlatList/SwiperFlatList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export const SwiperFlatList = React.forwardRef(
// https://upmostly.com/tutorials/settimeout-in-react-components-using-hooks
return () => clearTimeout(autoplayTimer);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [currentIndexes.index]);
}, [currentIndexes.index, _data.length]);

const _onMomentumScrollEnd: FlatListProps<unknown>['onMomentumScrollEnd'] = (event) => {
// NOTE: Method not executed when call "flatListElement?.current?.scrollToIndex"
Expand Down

0 comments on commit 94a415d

Please sign in to comment.