Skip to content

Fix iOS removeClippedSubviews being lost on recycled views - #58915

Closed
mozzius wants to merge 1 commit into
react:mainfrom
mozzius:fix-remove-clipped-subviews-recycle
Closed

mozzius wants to merge 1 commit into
react:mainfrom
mozzius:fix-remove-clipped-subviews-recycle

Conversation

@mozzius

@mozzius mozzius commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Summary:

On iOS, prepareForRecycle resets _removeClippedSubviews to NO but keeps _props, and updateProps:oldProps: only set the flag when removeClippedSubviews differed from _props. So a recycled view whose previous props also had removeClippedSubviews never turned clipping back on, and a remounted ScrollView/FlatList kept every row attached. This compares against _removeClippedSubviews itself, and adds a test.

Fixes #58914. Repro: https://github.com/mozzius/view-remove-clipped-subviews-recycle-repro

Changelog:

[IOS] [FIXED] - removeClippedSubviews is kept on recycled views

Test Plan:

In the repro (a ScrollView with removeClippedSubviews and 100 rows, unmounted and mounted again), the recycled content view keeps all 100/100 rows attached on every remount without this change (7/7, including 3/3 on unmodified 0.87.1), and 7/100 with it (3/3), the same as on first mount. The new RCTViewComponentViewTests case, run inside the repro app against 0.87.1 built from source, fails without the change and passes with it.

🤖 Generated with Claude Code

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

@cipolleschi cipolleschi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this

@meta-codesync

meta-codesync Bot commented Oct 7, 2026

Copy link
Copy Markdown

@cipolleschi has imported this pull request. If you are a Meta employee, you can view this in D123878627.

@meta-codesync meta-codesync Bot closed this in ff78e95 Oct 7, 2026
@meta-codesync meta-codesync Bot added the Merged This PR has been merged. label Oct 7, 2026
@meta-codesync

meta-codesync Bot commented Oct 7, 2026

Copy link
Copy Markdown

@cipolleschi merged this pull request in ff78e95.

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. Merged This PR has been merged. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

iOS: removeClippedSubviews is lost when a view is recycled

2 participants