You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit be0a23d
Browse filesBrowse the repository at this point in the historyBrowse files
Fix viewability reporting for cross-orientation nested lists (#58412)
Summary:
Pull Request resolved: #58412
A horizontal `VirtualizedList` nested inside a vertical list could report its items through `onViewableItemsChanged` while the parent row was off screen. The existing same-orientation nesting path translates parent scroll metrics, but cross-orientation children have independent scroll axes and therefore need the visibility of their containing row as a separate signal.
Expose a semantic cell-visibility query through `VirtualizedListContext` and register cross-orientation children with the key of their containing cell. Parents evaluate those cells after scroll and layout changes, but invoke children only when the ancestor suppression state transitions. Known data rows without layout metrics fail closed, eliminating transient mount reports, while unsupported structural cells preserve the previous behavior.
Explicit suppression now clears previously published viewability tokens even when current cell metrics are unavailable. It also invalidates stale `minimumViewTime` work. Suppression propagates through deeper cross-orientation nesting, and parent registration is reconciled when orientation or context changes so unmount always cleans up the exact collection that was registered.
The new behavior is gated behind the `fixCrossOrientationNestedListViewability` JS feature flag, which defaults to off. While it is off, parents do not expose the cell-visibility query, so cross-orientation children are never registered or suppressed and nested lists behave as before. Independently of the flag, `ViewabilityHelper` now invalidates a pending `minimumViewTime` callback when an update returns early.
The implementation is kept in sync across the main, Windows, and macOS variants. The generated public API snapshot is updated accordingly.
Fixes#57797Fixes#57778
Changelog:
[General][Fixed] - Do not report viewable items for a cross-orientation nested list while its parent row is off screen
Reviewed By: Abbondanzo
Differential Revision: D117727511
'When enabled, a VirtualizedList nested inside a list of the opposite orientation does not report viewable items while its containing cell is outside the parent viewport.',
* When enabled, a VirtualizedList nested inside a list of the opposite orientation does not report viewable items while its containing cell is outside the parent viewport.
* Fixing an edge case where the current window size is not properly calculated with fast scrolling. Window size collapsed to 1 element even if windowSize more than the current amount of elements
0 commit comments