recyclerlistview icon indicating copy to clipboard operation
recyclerlistview copied to clipboard

Inifinite scroll with renderAheadOffset

Open anatoleblanc opened this issue 3 years ago • 3 comments

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 !

anatoleblanc avatar May 08 '22 09:05 anatoleblanc

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

juansirone avatar Jun 18 '22 00:06 juansirone

Use something like this: https://github.com/callstack/react-native-pager-view

arjendevos avatar Aug 01 '22 14:08 arjendevos

Thanks for the answer. I'll try this library :)

anatoleblanc avatar Aug 01 '22 14:08 anatoleblanc