recyclerlistview
recyclerlistview copied to clipboard
Inifinite scroll with renderAheadOffset
Hi all,
Thanks to developers for this library, so helpful !!
I am doing a TikTok like video app, which includes an infinite video list. To preload video, I need a view to be rendred ahead of its appearance on the screen. I can do this with the props renderAheadOffset for the first items of my list. However, there is a time when the size of my list becomes higher than the value I give in renderAheadOffset (as it is infinite). Is there any possible way to have an infinite value in renderAheadOffset, so that when I add data to my dataProvider, the recyclerList renders new data added before it comes into view ?
Thanks a lot for the help, much appreciated !
As I understand renderAheadOffset is better to keep in lower value to avoid re-renders, you can set onEndReachedThreshold with the desired distance than you want fetch or add data (example: the size of an item on your list * 3 ) and onEndReached will fetch or append the data to the list with the onEndReachedThreshold value
Use something like this: https://github.com/callstack/react-native-pager-view
Thanks for the answer. I'll try this library :)