Fix inverted FlatList RefreshControl indicator position#55464
Fix inverted FlatList RefreshControl indicator position#55464Navjot1806 wants to merge 2 commits intofacebook:mainfrom
Conversation
When using an inverted FlatList with onRefresh/refreshing, the RefreshControl activity indicator appears at the visual bottom of the list instead of the visual top. This is because the scaleY: -1 transform applied to the ScrollView flips the entire view including the RefreshControl. This fix automatically sets progressViewOffset on the RefreshControl when the list is inverted, repositioning the refresh indicator at the visual top of the list. The offset is calculated from the visible height of the scroll view after layout. The user-provided progressViewOffset is respected when explicitly set. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Hi @Navjot1806! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
Fixes #17553
When using an inverted
FlatListwithonRefresh/refreshing, theRefreshControlactivity indicator appears at the visual bottom of the list instead of the visual top. This is because thescaleY: -1transform applied to theScrollViewflips the entire view including theRefreshControl.This PR automatically sets
progressViewOffseton theRefreshControlwhen the list is inverted, repositioning the refresh indicator at the visual top of the list. The offset is calculated from the visible height of the scroll view after layout.Changes
VirtualizedList.js: In_defaultRenderScrollComponent, whenisInvertedVirtualizedLististrueand the user hasn't provided a customprogressViewOffset, automatically calculate and passprogressViewOffsetequal tovisibleLengthto reposition the refresh indicator at the visual top.VirtualizedList-test.js: Added 3 new test cases:progressViewOffsetis set onRefreshControlwhen inverted and layout is knownprogressViewOffsetis NOT set when the list is not invertedprogressViewOffsetis respected when invertedBehavior
Note
This fix repositions the visual indicator to the correct location. The pull-to-refresh gesture direction (which is tied to the native scroll view behavior) would require native-level changes to fully resolve and is tracked separately.
Changelog
[GENERAL] [FIXED] - Fix inverted FlatList RefreshControl indicator appearing at the visual bottom instead of visual top (#17553)
Test Plan
VirtualizedList-test.jsthat verify theprogressViewOffsetbehavior for inverted lists🤖 Generated with Claude Code