Reputation: 119
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
Upvotes: 3
Views: 6830
Reputation: 8585
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
Upvotes: 3