Two way infinite scrolling responsive to native

I am doing a "todo" for a calendar app. When you scroll to the bottom of the list, it grabs upcoming events from the server and puts them at the bottom of the list. It's easy if you react to your own. However, I would also like to allow the user to scroll up to view older dates and events. When they get to the top of the list, load the previous items. Unfortunately there is no equivalent onEndReached

, but for starters. Any ideas / recommendations on the best way to handle this?

+3


source to share


1 answer


Could you please use a callback ScrollView

onScroll

. The event argument gives you the scroll position. When the value goes back to 0, you can load more items and add them.

To do this, you will probably need to keep the previous value for comparison in order to determine the scroll direction.



Also see this question: React native: Get the current scrollview scroll position

+2


source







All Articles