Repository navigation
Use the latest onViewableItemsChanged in VirtualizedList - #60574
Draft
neeleshyadav253 wants to merge 1 commit into
Draft
neeleshyadav253 wants to merge 1 commit into
neeleshyadav253 wants to merge 1 commit into
Conversation
The viewability tuples were built once in the constructor, so a changed onViewableItemsChanged was never called and a callback added after mount was ignored. Sync the callback on each update and create the tuple when the callback first appears. Helpers are reused so their viewable-index state is kept. Signed-off-by: Neelesh-fs-dev <neeleshy263@gmail.com>
neeleshyadav253
force-pushed
the
fix/viewable-items-changed-on-the-fly
branch
from
December 5, 2026 04:25
f3d1b25 to
227db35
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
VirtualizedListbuilds its viewability tuples once, in the constructor. As a result, a changedonViewableItemsChangedprop was never called, and a callback added after mount was ignored. This change syncs the callback on each update and creates the tuple when the callback first appears. Existing helpers are reused, so their viewable-index state is kept.Fixes #30171
Changelog:
[GENERAL] [FIXED] - FlatList and SectionList now call the latest onViewableItemsChanged after the prop changes or is added after mount.
Test Plan:
packages/virtualized-lists/Lists/__tests__/VirtualizedList-test.js. Both failed before the change and pass after it.yarn jest packages/virtualized-lists: 11 suites passed, 208 tests passed, 1 skipped, 69 snapshots passed.yarn eslint packages/virtualized-lists/Lists/VirtualizedList.js packages/virtualized-lists/Lists/__tests__/VirtualizedList-test.js --max-warnings 0: exit 0.yarn prettier --checkon the two files: passed.yarn flow-check: 0 errors.viewabilityConfigafter mount still uses the original helper config.