Fix inverted FlatList RefreshControl indicator appearing at visual bottom (#17553) - #57905
Open
kulkarni-rohan wants to merge 1 commit into
Open
Fix inverted FlatList RefreshControl indicator appearing at visual bottom (#17553)#57905kulkarni-rohan wants to merge 1 commit into
kulkarni-rohan wants to merge 1 commit into
Conversation
…t#17553) When FlatList is inverted, scaleY: -1 transform causes RefreshControl to appear at visual bottom instead of visual top. This fix auto-calculates progressViewOffset = visibleLength when inverted and no user offset is provided, moving the Android SwipeRefreshLayout indicator to visual top. Also clones custom refreshControl with offset when needed. Fixes react#17553 Supersedes react#55464 with custom-control handling. [GENERAL] [FIXED] - Fix inverted FlatList RefreshControl indicator appearing at visual bottom instead of visual top (react#17553)
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.
Fixes #17553
Summary
Problem:
FlatListwithinverted={true}is used for chat/terminal UIs. It appliestransform: [{scaleY: -1}]to the ScrollView and re-flips cells.RefreshControlis a child of inverted ScrollView, so it appears at physical top = visual bottom, while users expect it at visual top.Root cause:
_defaultRenderScrollComponentinVirtualizedList.jspassedprogressViewOffsetwithout accounting for inversion.Fix (JS-only, 21 lines, no new API):
progressViewOffset = visibleLengthwhenisInvertedVirtualizedList && props.progressViewOffset==null && visibleLength>0SwipeRefreshLayoutuses offset to move indicator to visual top (physical bottom = visual top after scaleY:-1)refreshControlwith offset when needed – improvement over Fix inverted FlatList RefreshControl indicator position #55464 which ignored custom casevisibleLength>0to avoid flicker before layoutSupersedes #55464 (stalled, CI failing) with custom-control hardening.
Changelog:
[General] [Fixed] - Fix inverted FlatList RefreshControl indicator appearing at visual bottom instead of visual top (#17553)
Test Plan
Risks
Low – only affects inverted lists with onRefresh. Non-inverted unchanged. Snapshots still pass.
Known Limitation
Pull gesture still triggers at physical top (visual bottom) because native UIRefreshControl/SwipeRefreshLayout edge is at offset 0. This PR fixes indicator position (main bug title). Full gesture inversion needs native change, tracked separately.
Fixes #17553