-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
[Android] FlatList does not update with initialScrollIndex > 0 and not scrollable #33529
Labels
Comments
AntoineDoubovetzky
pushed a commit
to AntoineDoubovetzky/react-native
that referenced
this issue
Apr 3, 2022
This test case is based on this issue: facebook#33529
AntoineDoubovetzky
pushed a commit
to AntoineDoubovetzky/react-native
that referenced
this issue
Apr 20, 2022
This test case is based on this issue: facebook#33529
AntoineDoubovetzky
pushed a commit
to AntoineDoubovetzky/react-native
that referenced
this issue
Apr 20, 2022
This test case is based on this issue: facebook#33529
Saadnajmi
pushed a commit
to Saadnajmi/react-native-macos
that referenced
this issue
Jan 15, 2023
…s when data is updated (facebook#33558) Summary: Fixes facebook#33529 (note that I reproduced the bug on iOS too). The bug comes from the fact that we were using `this._scrollMetrics.offset` to determine if the initial scroll was done. But sometimes it equals 0 even after the initial scroll is done, for example when the content does not fill the list. So I replaced it with `this._hasDoneInitialScroll`. I believe that `this._hasDoneInitialScroll` was not used in the first place because it was introduced later (3 years ago vs 5 years ago for the original code). The replacement correctly fixes the broken test case and the example given in the issue. Then I had to update two test cases (rename the first and remove the second), that shows explicitly the broken behavior: we have to simulate the initial scroll for the content to be adjusted, so when the content does not fill the view and the scroll cannot be executed, the content is not adjusted. ## Changelog [General] [Fix] - Fix VirtualizedList with initialScrollIndex not rendering all elements when data is updated Pull Request resolved: facebook#33558 Test Plan: - I added a broken test case based on the issue - I tested with the RNTesterApp using the code example given in the issue Reviewed By: ryancat Differential Revision: D35503114 Pulled By: yungsters fbshipit-source-id: 67bb75d7cf1ebac0d59127d0d45afbaa3167dcf3
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
When the initialScrollIndex is > 0 and the data is not long enough to scroll and then the data is updated, the new elements are not shown.
See the code-example
Version
0.67.4
Output of
npx react-native info
Steps to reproduce
Snack, code example, screenshot, or link to a repository
The text was updated successfully, but these errors were encountered: