How to implement the pagination in react native? not using srollable view, list view or load more function. The pagination function got the next, previous button and current page selection in react native, may I know it can be done in react native? Thank you
Asked
Active
Viewed 6,337 times
3
-
Possible duplicate of [pagination in react native](https://stackoverflow.com/questions/49452707/pagination-in-react-native) – Harry B Jul 16 '18 at 11:19
1 Answers
3
I didn't find a solution for this either so I created a plugin for this https://github.com/garrettmac/react-native-pagination
but to answer your question the magic is done in the onViewableItemsChanged
prop function that pops out two params one the returns an array of changes items and the other that that returns an array of visable items you can use those to track and manipulate your array to position correctly depending how you're doing your pagination. I'm answering this from mobile but I think ListView, Flatlist (which you should use over ListView) and SectionView all share this prop. Good luck

garrettmac
- 8,417
- 3
- 41
- 60
-
Hi, I have tried your example but only the Horizontal Paged Example it works but the others returned with the error message "undefined is not an object (evaluating 'element.props')", may I know can you solve the issues? Thank you also for posting the answer. – johnhour Sep 15 '17 at 03:08
-
@Vyga hi, should we limit our lists when fetching long lists of data to be displayed in react native. Are there performance issues if we do that? I am using firebase as backend. – Yasir Oct 29 '17 at 06:26
-
1@Yasir Then i think this is what you are looking for https://stackoverflow.com/a/16240601/4642530 – garrettmac Oct 31 '17 at 03:51
-