I'm new to react native and I want to fetch data when user stops scrolling or goes to end/bottom of the screen.
Asked
Active
Viewed 958 times
0
-
What have you tried so far? – Emil Karlsson Oct 25 '21 at 12:34
-
Using ScrollView you have the onScroll prop, that you can use to fire the data fetching. Personally, I recommend you use FlatList, there you have onViewableItemsChanged and onEndReached prop that you can use to do what you want. Please check the official docs for more info. – Jancer Lima Oct 25 '21 at 12:38
-
I have tried onScroll method but it calls multiple times and I wrapped my views under scrollview – Manish kumar Oct 25 '21 at 12:40
-
https://stackoverflow.com/questions/41056761/detect-scrollview-has-reached-the-end this helped me – Manish kumar Oct 25 '21 at 12:52
1 Answers
1
You could try something like this How do I check when the user has stopped scrolling?, but in react native best practice is to use a Flatlist (https://reactnative.dev/docs/flatlist) when you don't know how much data you will render

Louis
- 46
- 5