-
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
Large Flatlist is not rendering all items #15990
Comments
This happens because it is a virtualized list and loads the array bit by bit |
Does it render them when you scroll? Or do they literally never show up? |
No it does not render at all. But it is doing the following when is not rendering all items, it shows a white space but when i touch it, it aligns properly to the last item (but the rest not rendered and never shown). |
@stefan0s have you disabled |
+1 I get this also in Section List - it stops at 120 for some reason - I can paginate up to 6 pages of 20 - I console.log the data in there after a async load and it is more than 120. |
I solved my problem: |
@stefan0s If you haven't already looked into PureComponent or shouldComponentUpdate in relation to FlatList or VirtualizedList, read this: https://60devs.com/pure-component-in-react.html There is a HUGE performance difference when you implement a customized shouldComponentUpdate function with each of your entries - assuming they are various React Components you are rendering. |
FlatList and SectionList is bad performance. Try this,please. may be it is a surprise for you |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions. |
Hi, I'm running react-native v0.52.8 and I have the same issue. Will this be fixed? or we have to use third party components? |
I am having a similar issue, but not even on large lists, sometimes it just only renders partial rows, and the rest of the data are all just blank which you can clearly see that the list left some blank space for the rest of the data, but just not rendering them. |
We have the same issue on android and have to revert to ListView. It does seem to render, the jumping of next batch being rendered is visible but at some point it just cuts off. The space is reserved but nothing is visible. In fact, inspecting it (react views) shows the space. Everything is in the tree, it just doesn't show (or shows transparent). Note: When making the items considerably smaller (20 height) the entire list does render. So it looks like there's some sort of cut-off point. |
Does anyone have a fix for this issue? |
Does anyone have a fix for this issue? (bis) |
I'm having a similar issue on android not iOS, running react-native v0.55.4. |
I have the same issue on android, RN v0.56. List is only 13 items. |
@RWOverdijk this worked, thanks. I was having the same issue with long lists on ios. I have list items that can display more items on a button click. The flatlist would grow the the correct length/height, but would stop rendering at either 10 or 15 items, and only display a blank white area for the rest of the list. No issues on android with FlatList. |
One word. RecyclerListView. fades into the shadows |
I decided to use ScrollView and rendering the list of items and header by myself, I know that this can have some performance problems but it works for me now. <ScrollView >
<MyHeaderComponent/>
{
items.map((item) => {
return <MyRowComponent item={item}/>
})
}
</ScrollView> |
I solved the issue by removing |
@simonas88 it worked for me too |
If it's a performance problem caused by listview |
For partial shown short list: added those values to FlatList and problem gone:
honestly i don't know which one fixes the problem or if works for large data. |
CC: @sahrens does the workaround to set |
remove |
I have the issue where only the initial buffer is rendered and no other items (left blank when scrolling). Can confirm it has something to do with What is strange is that it works in a storybook (minimal use case) but not inside the app (maybe react-navigation related?). Also in my case the Only workaround so far is edit: Another thing that fixes it is to add Looking at the code it looks like the culprit might be this line in Libraries/Lists/VirtualizedList.js: const onLayout =
/* $FlowFixMe(>=0.68.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.68 was deployed. To see the error delete this
* comment and run Flow. */
getItemLayout && !parentProps.debug && !fillRateHelper.enabled()
? undefined
: this.props.onLayout; Not sure what it is supposed to optimize away... edit : Can confirm that bypassing this ternary (eg. |
@mgcrea are you wrapping the
|
Wrapping in ScrollView and long running animations are the two main sources I've seen for issues like this. 8f186b8 should fix the latter in many cases. I don't think this Issue is actionable unless someone can provide a repro, e.g. in snack. |
@nicolasdanelon could have been that since I had a tree looking like: Here is the preview of the component/bug: And a Preview of the Tree after swapping the Form's Will try to setup a repro on Snack soon, for now I have the workaround of patching the VirtualizedList source that does the job (hopefully without nasty side effects!). Thanks! |
You just need to add attribute initialNumToRender in your Flatlist. Example:
|
initialNumToRender worked for me |
solved for me, thanks @satellink |
yes @kuriel-trivu has the right solution |
Sorry to say, but I didn't find any solution working for me. I'm still facing the same issue. |
Unfortunately not using getItemLayout has proven to be the most stable way to render FlatLists for my team. I've made this eslint rule to enforce the prop isn't being used until this issue can be resolved – seems like tooling like this is a good way to enforce not using flaky parts of react native. https://github.com/tvler/eslint-plugin-react-native-no-get-item-layout-prop-on-virtualized-list |
I have try all solution stated above. But no one has worked for my case. It is so weird. Look at my app react-devtools capture. Only first item that wont rendered. it is not always first item that wont rendered sometimes other item of my list. I try to figure out by put log on Any idea to solve this issue? |
it works.. my problem is i found that 1 category not showing all datas, it has 92 data but only showing 15. i tried change initialNumToRender value to other number, so i can confirm it is a bug from initialNumToRender in Flatlist. right now i set to 20 because performance considerations, it solved the problem too. |
so this the main issue?? |
@ezailWang This worked for me. Thanks dude.
|
I faced this issue as well. initialNumToRender={data.length} does not work for me. |
@satellink I think your suggestion (setting From the RN docs on |
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions. |
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information. |
Is this a bug report?
This seems to be a bug of the FlatList while trying to render many items (more that 60-70).
Have you read the Contributing Guidelines?
(Write your answer here.)
Environment
We are using macOS and the issue happen on both iphone and android
react-native -v
: 0.45.1node -v
: 6.9.1npm -v
: 3.10.8yarn --version
:Then, specify:
Steps to Reproduce
We are using FlatList to render Message Items and after the Flatlist has been rendered we are using scrollToBottom to go to the last item. The Flatlist is working without any issues when having about 20 items, but when we have many items it is NOT always rendering them and not display them at all. We are having an example with 80 items and sometimes is rendering all of them but most of the times is rendering about 40.
The text was updated successfully, but these errors were encountered: