Repository navigation
Conversation
Visual regressionNo visual differences at android: no capture |
cipolleschi
approved these changes
Nov 24, 2026
|
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this in D134268351. |
javache
reviewed
Nov 25, 2026
|
|
||
| - (void)_prepareForMaintainVisibleScrollPosition | ||
| { | ||
| _firstVisibleView = nil; |
Contributor
There was a problem hiding this comment.
We're not resetting _firstVisibleViewTag and _prevFirstVisibleFrame either, should we?
Contributor
Author
There was a problem hiding this comment.
I left them alone because adjust bails out when _firstVisibleView is nil before it reads either one, and prepare always sets all three together. Happy to reset them too if you want it to match prepareForRecycle.
javache
approved these changes
Nov 25, 2026
javache
left a comment
Contributor
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
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:
On iOS,
_prepareForMaintainVisibleScrollPositionreturns early when there is no child atminIndexForVisible(or whenmaintainVisibleContentPositionis off), but it kept the anchor from the previous mount._adjustForMaintainVisibleContentPositionthen measured that old anchor against its old frame again and applied the same delta on every commit. Each adjustment firesonScroll, which can commit again, so an invertedFlatListwith a header that drops to a single row scrolls away on its own.The anchor is now cleared at the start of every prepare, so adjust only uses one picked for the current mount.
Fixes #60260
Changelog:
[IOS] [FIXED] - Fix maintainVisibleContentPosition scrolling the list away when no anchor is found at minIndexForVisible
Test Plan:
Added
testMaintainVisibleContentPositionWithoutAnchorDoesNotReuseThePreviousOnetoRCTScrollViewComponentViewTests. It anchors on a row, removes the header so the row moves up, then runs a second mount with only that row left. Without the fix the second mount should shift the offset again (-50 to -100). I don't have Xcode on this machine, so I haven't run the XCTest or the reproducer; both files are clang-formatted. The reporter tested the same one-line change from source and the list held still.