react-native-recyclerview-list
react-native-recyclerview-list copied to clipboard
Horizontal Scroll
Just wondering, Is it hard to implement horizontal & paged scroll?
Horizontal is not hard, I think. But if you need paged scroll why don't you use a FlatList/ScrollView?
Yeah, I use flatlist.
Here is the case. I have 30 pages built with FlatList (Horizontal Paged), Each page have your library which is the awesome recyclerview-list đ .
The pain part is navigating between pages. it's really slow and ruin the experience, i don't know if it's the FlatList or recyclerview-list issue âšī¸ . checkout the video here
It seems a deep rendering issue. When you press the "Go to Juz" button probably you update the prop of a component that renders again the horizontal flatlist and then all the recyclerviews. Since there are 30 recyclerviews, the process is quite slow. You should not re-render all the components, but just call the scrollToIndex method of the FlatList. Do you do that?
Yes, the onPress props only contain the scrollToIndex method for changing the page, there is no updating props.
Mmm... you should investigate more on what's going on.
- If you replace
recyclerview-listwith a coloredViewdoes the issue appear? - Try putting a
console.logfor eachrecyclerview-listwhen it renders. Are therecyclerview-listrendered many times? - Try putting a
console.logfor each item of therecyclerview-listwhen it renders. Are the items rendered many times?
Another idea... maybe the modal that contains the "Go to Juz" button when it closes it triggers a new render of the whole page
There is no action to trigger a new render. From my experience, it comes from the flatlist, if we navigate to the item that not in the view boundary it kinda have a delay from rendering.
Just like the vertical scroll, unlike your library, flatlist will show blank page if we navigate far down the list and sometimes it stop before the target đ.
Ok understood.
Try tweaking the props initialNumToRender and windowSize of the FlatList, and initialListSize and windowSize of the RecyclerviewList. For example, I see from the video that your items are quite big, a value of 3 for initialListSize should be ok, and 6 or 9 for windowSize (of the RecyclerviewList).
Already did that, there still slight delay. đ
I tried adding maxToRenderPerBatch = {2} to FlatList and
windowSize = {5}
initialListSize = {4}
A bit faster now. But i am still hoping for horizontal,paging props on your libs to see the performance difference :)