Flipkart / recyclerlistview

High performance listview for React Native and web!
Apache License 2.0
5.26k stars 429 forks source link

onEndReached causes list teleportation #626

Open isinuyk opened 3 years ago

isinuyk commented 3 years ago

I'm trying to implement RecycleListView instead of default FlatList in my chat component. Also, I'm using react-native-text-size to calculate text message height. Everything works well. But when I tried to implement the fetchMore feature using onEndReached from the RecycleListView I faced one problem. When I got new messages my list teleports down a little and scrolling stops.

https://user-images.githubusercontent.com/72970722/124729276-f7879880-df18-11eb-8197-aa9745153b05.mov

The only thing that I understood it happens when I recreate LayoutProvider with the new messages.

image initFlatHeights() function fires everytime when I got new messages

Orange9000 commented 3 years ago

Facing the same issue

Orange9000 commented 3 years ago

In my case, it was because I had layoutProvider inside render(). Fixed it by moving layoutProvider to constructor.

vijaychouhan-rails commented 3 years ago

layoutProvider

Working fine, I am using functional component and moved layoutProvider outside of function

Only-IceSoul commented 3 years ago

remove setLayoutProvider. If you have a loading view, you should not remove it until there is no more data