-
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
VirtualizedList + getItemLayout only renders initialNumToRender items #15734
Comments
Hey, I've just run to a similar problem: the FlatList w/ After some debugging with the RN internals, I've discovered that we had a never ending animation that was preventing FlatList to update, since it uses Also, with your fix, Hope it helps! |
@duailibe Interesting... In my case my fix does not lead to situations where I am also not too happy about the turnaround times for bug triages. I'll close this bug in 3 weeks if nobody from Facebook has looked at it by then (as I have done before). |
After working with Here are my recommendations:
Good luck, I am closing this issue. |
@PublicParadise Your idea of changing |
My current workaround is to override // custom-flat-list.js
// custom-virtualized-list.js
This way, |
@dotansimha Your workaround is much cleaner than what I am doing, which is patching the code in my "scripts": {
"postinstall": "./scripts/postInstall.sh",
... My # VirtualizedList + getItemLayout only renders initialNumToRender items
# @see https://github.com/facebook/react-native/issues/15734
# getItemLayout does not work
sed -i.bak -e 's/const onLayout =$/const onLayout = false \&\&/' node_modules/react-native/Libraries/Lists/VirtualizedList.js I was happy for about two weeks. Then I realized that my fix only worked for small lists. Once I used lists with about 1100 items everything fell apart. For example I did things like: scroll to item # 678 followed by manually scrolling one or two pages up. The result was often if not always a blank screen. I switched back to removing my patch and avoiding |
Just stumbled over this issue that touches on some of the current problems with In particular:
as well as this note for Android:
I find the list of dedicated FlatList issues quite discouraging... |
FYI: Vote for React Native's feature requests so we can improve the plugin |
…s but the initial ones to be rendered Fixes #193. Modifications are based on what is discussed in [this thread](facebook/react-native#15734).
Why is this issue closed? If |
This issue hasn't been solved yet. Please reopen. Also...I noticed |
when use getItemLayout, After pull request the api, the page will first white for a moment, and then the content show. This video show the phenomenon, https://youtu.be/SmsEalsACQQ |
Issue should still be open. |
Bump this. Spent ages trying to figure out why I had no items rendering outside of the initial ones that rendered, only to stumble onto this issue some time later. Clarify that it works fine on iOS, and when debugging remotely on Android. It's only the production version of Android that it fails (it works if the debug flag is set). This can't be intended behaviour. Is no-one at FB using FlatList? |
@deecewan The problem is that What I saw cannot be unseen, though. For that reason I am supporting @bd-arc if he wants to replace |
oh, no. mine is quite simple - horizontal scrolling a full-width 'page', so the width never changes. there is also no animation. making the change you suggested at the top ( I haven't looked at it (or anything similar), but I'm not sure why it's so difficult to build? Render empty placeholders everywhere if the index is outside of |
This bug should definitely still be open. If the getItemLayout prop is passed then SectionList, FlatList and VirtualizedList all seem to be broken where you have a large blank space inside the list, but if you don't pass the prop then you can't use any of the scroll methods. @gaearon You wanted people to ping you when there's critical issues that aren't being addressed. This is a good example. |
My workaround:
so it renders the whole list. |
Is this a bug report?
Yes
Have you read the Contributing Guidelines?
Yes
Environment
react-native -v
: 0.47.2node -v
: v6.10.3npm -v
: 3.10.10yarn --version
: n/aThen, specify:
Steps to Reproduce
(Write your steps here:)
FlatList
w/tgetItemLayout
, i.e.I am using the standard
getItemLayout
:initialNumToRender
itemsExpected Behavior
(Write what you thought would happen.)
All items are rendered.
Actual Behavior
Only
initialNumToRender
items are rendered.(Write what happened. Add screenshots!)
Reproducible Demo
The bug is in VirtualizedList:
The fix is:
You need
onLayout
because somebody needs to call_onCellLayout(e, key, ii)
.(Paste the link to an example project and exact instructions to reproduce the issue.)
The text was updated successfully, but these errors were encountered: