-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FlatList] FlatList and VirtualizedList Scroll performance is laggy after 30+ rows . #13413
Comments
Its most likely due to the nested components as you mentioned (nothing to do with HQ images).
statement again, but when |
@jpshelley hey man , Thanks for the idea . Actually you saved me , but in an another way . I only upgraded to 0.43 just for VirtualizedList thinking it would have great performance . But it turned out it's not mature enough and lots of bugs to be fixed yet . Scrolling was quicker (i mean it fetches data before the onEndReach) but laggy (i mean shaky) . Implenting shouldComponentUpdate makes the scroll performance more horrible (but responsiveness got fixed) . |
I'll add one more piece of information that might be relevant for a fix: When I was investigating the issue mentioned above, I spent a lot of time pulling out pieces of code that could cause unnecessary updates. Additionally, I implemented The only way to prevent the jumpy scrolling behavior was to set |
@SunburtReynolds Hey , you are absolutely right . And there's also an another issue with the new the updated version of Flatlist , which have separated the Fillrate function . The Fillrate logic was not performing good and it causes shakiness during scroll as is preassumed height was not equal to the height after rendering . Lots of bugs has to be fixed . So I downgraded to listview again . You can achieve a similer kind of smooth scroll in listview using dynamic onEndReachedThreshold . Suppose for a datasource of length N , you can set the threshold as n*N where n is a constant floating point and N is dynamic length. |
We need to be able to control the |
I have the same issue, but got it solved 😃 see more of the fix here: |
@Stoffern I'm already replicating this behavior with my code base using FlatList, as I'm rendering lots of images / videos. But unfortunately with Android FlatList behaves entirely differently and keeping the |
@gp3gp3gp3 try my library and see if it works. I dont keep them in the state as that would cause the FlatList to do a full re-render everytime a item changed. Look at my code and see if that makes more sense 😉 |
Tried different ways and methods with Flatlist; spent 2 days experimenting with it, but its not prime time if you are looking to render pics and videos in a list. ListView still works smoothly. |
Add the following props in your Flatlist its work |
Doesn't that basically turn the FlatList into a ListView though? |
FWIW, version 0.45.1 seems to have fixed the jumpy scrolling issue! |
Wrapping the whole Flatlist in a ScrollView worked for me. |
@Stoffern have tried your lib and it doesn't help. |
is there a fix yet? |
I remember when I started this project at 0.29... feels like Ive been chasing the magic dragon updating every minor version. +1 for listview |
I changed my render item component into PureComponent and it works fine |
+1 |
We've had lot of problems with react native listview as well so, we built one ourselves, just open sourced it. We've tested it with 5000 items works like a charm. The reason it's so fast is that it uses a quick staggered grid algorithm and recycles views (based on types) instead of destroying them once they're out of view port. Please try it out and give us feedback https://www.npmjs.com/package/recyclerlistview |
Hei @naqvitalha , Its really good to know that you have created an recyclerview library . I was always looking for that . However ,it was for an another reason , I needed a component to build snapped scrollviews like google-play-store apps scroll . React-native currently lacks that library . I wonder why nobody has created one yet . Please let me know if you can add that functionality with snaphelper , I believe it's possible only using recyclerview . Here re some links you can have a look . https://rubensousa.github.io/2016/08/recyclerviewsnap https://blog.mindorks.com/using-snaphelper-in-recyclerview-fc616b6833e8 |
@PARAGJYOTI The listview that I talked about is not based on native recycler view, it's written from scratch purely in JS, making it cross platform (also web :) ). You can open an issue. We can certainly add this in the future. |
@naqvitalha Owh , I thought it was native . Anyway , is flipkart also using react-native for mobile ? |
@PARAGJYOTI Yes we are. |
I don't know why, but try legacyImplementation, it does the trick |
+1 have the same performance problem |
So am I 😢 |
Then why don't you guys give RecyclerListView a chance? https://www.npmjs.com/package/recyclerlistview |
@naqvitalha In recyclerlistView why need ViewTypes , I not really got it |
ViewTypes are needed to efficiently recycle cells. So that similar looking cells are recycled. You can just return one type in layout provider in case you don't need it. |
I am working on a PR related to FlatList performance. Please take a look to see if it fixes this issue: #31327 |
I used 'react-native-optimized-flatlist' Good luck. |
I set the height of the Flatlist to the height of the screen. It worked for me. |
@halaei Were you able to merge that PR ? |
@Arlien No i wasn't. I don't know what is the next step. |
@halaei yeah, this issue is very important but none of the fixes I've found on here has helped on my case. It's time for this to get patched... |
same here |
Yeah same here...I keep getting "You have a large list that is slow to update". |
Same here, i've switched to the v8 runtime and solved the performance problem on Android, but it doesn't work on iOS (because apple do not allow standalone executables). Any news on dealing with this? |
could you explain me better how to configure this v8 runtime? |
@osvaldokalvaitir i've used this npm package https://github.com/Kudo/react-native-v8 Just follow their tutorial |
I'm migrating my Android app (Hours) from Cordova to React Native to get better performance and a more modern stack. Much to my surprise the infinite scroll view I implemented for cordova is way more performant than React Native's VirtualizedList, also after I've done the usual optimizations tricks (no arrow functions, data with keys, etc.). After a lot of experimenting it's getting obvious that the performance simply won't be good enough. My old solution is fast because it recycles the rows, whereas VirtualizedList sort-of bruteforces the issue by rendering items ahead of when they are going to be visible. It's a workable solution if the users are scrolling slowly and the row components are all different and expensive to render. Unfortunately it's a very wasteful and slow solution when the rows are the same, and scroll needs to be very fast. I honestly can't believe that React Native doesn't come with a good solution for this. With the use of component recycling it really should be possible to fill the screen with a complete set of new rows every frame - thus eliminating the need to render ahead. I'll take a stab at implementing a useful solution, but this limitation has honestly drained me of motivation. I wonder if the other multi platform frameworks are equally bad at solving this problem. |
@jeppester u can try v8 engine. I have a social media app, rendering around 180 items consisting of autoplay videos, stories, carousels, photos just as we have in facebook app etc. These all without any lag. Facebook shows around 275 items. Here is the link of the app. U can check the type of items. |
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
@naqvitalha i have flatlist similar issues that contain image or video (react-native-video) and there is infinite list but i have faced similar problem can recyclerlist view solve my problem i used evrything but not get proper solution.Please help Sir... |
When opening the chat screen, I had some delay and laggy issues. I added a delay of 1 ms, and for that 1 ms, show some loader. This helps in opening the screen faster even though it has more items to render. Also, I have been using a flash list from Shopify. (https://github.com/Shopify/flash-list/tree/main) |
FlatList and VirtualizedList performance is not all good, for me the solution is make a Infinite Scroll kind of functionality that loads just the amount of necessary data to fill the mobile screen, 20 items should be enough for most of the devices. With this solution we went from near 30fps on first load of list to 90~80fps. |
So what do you think? Should I work on fixing this in react-native or it is just better using FlashList? |
In my case FlashList was a very good drop-in-replacement. I'm not sure that FlatList needs to be replaced with FlashList, but FlashList adds something that React Native lacks out of the box. I think the easiest solution for now would be to just add a reference to FlashList in the documentation, so that anyone facing performance issues will be directed towards something more performant. I must say that I never got very far with FlashList for my project. It performed very well, but I need much tighter control over the scroll momentum. Something I believe is currently impossible with either FlatList nor FlashList. |
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This issue was closed because it has been stalled for 7 days with no activity. |
+1 |
2 similar comments
+1 |
+1 |
Description
Flatlist or VirtualizedList Scroll lags horribly after 30-40 rows . I am fetching the same data on onEndReached . Upto 30 rows its looks fine , but after that scrolling drops several frames . When I disable virtualization , scroll becomes normal but but responsiveness goes away . I tried disabling virtualizing on scrolling velocity this way .
}
But again , there's problem for the unmounted Component that are removed from the views , which takes long time to show up again .
Is there any way to improve the scroll performance ?
Here's my sample code
My data is sort of large and nested object by the way .
And data contains High quality Images . Per row there's two Items . But I implemented it without using numColums for testing with Virtualizedlist instead of Flatlist , but same result . Is it due to the High quality Image or I am doing something wrong ?
Additional Information
The text was updated successfully, but these errors were encountered: