Skip to content

Fix iOS maintainVisibleContentPosition when the anchor straddling the top edge is resized - #58920

Open
mozzius wants to merge 1 commit into
react:mainfrom
mozzius:fix-mvcp-straddling-anchor
Open

mozzius wants to merge 1 commit into
react:mainfrom
mozzius:fix-mvcp-straddling-anchor

Conversation

@mozzius

@mozzius mozzius commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Summary:

On iOS, maintainVisibleContentPosition anchors on the first subview whose end is past the offset (#43203) and corrects by how far that view's origin moved. A view that straddles the top edge and is resized keeps its origin while everything after it moves, so nothing is corrected. After a prepend, that view is a VirtualizedList spacer being re-estimated, and the visible rows jump. This keeps #43203's anchor, but when it straddles the leading edge it also records the next subview, if that one starts inside the viewport, and measures it instead when the mount resized, recycled or removed the straddling anchor. Switching to "first fully visible" would also fix this, but it reverts #43203.

FlatList also needs #58916. With this fix alone, VirtualizedList unmounts the anchor and the row ends up 1828pt off.

Fixes #58913. Repro: https://github.com/mozzius/scrollview-mvcp-anchor-repro

Changelog:

[IOS] [FIXED] - maintainVisibleContentPosition corrects when the anchor straddling the top edge is resized, e.g. a VirtualizedList spacer after a prepend

Test Plan:

🤖 Generated with Claude Code

… top edge is resized

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 7, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Oct 7, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

1 participant