Skip to content

[Repro #60227] RNTester Playground: ScrollView clipping pass runs after every mounting transaction - #60229

Open
beqramo wants to merge 1 commit into
react:mainfrom
beqramo:playground-scrollview-clipping-repro
Open

beqramo wants to merge 1 commit into
react:mainfrom
beqramo:playground-scrollview-clipping-repro

Conversation

@beqramo

@beqramo beqramo commented Nov 23, 2026 •

Copy link
Copy Markdown

Summary:

Reproducer for #60227, as the bot asks: RNTesterPlayground.js edited to show the bug. Not meant to be merged.

On iOS (Fabric), -[RCTScrollViewComponentView mountingTransactionDidMount:withSurfaceTelemetry:] calls _remountChildren after every mounting transaction. _remountChildren walks the whole content of the ScrollView with updateClippedSubviewsWithClipRect:relativeToView:, one convertRect:toView: per view, even when no view sets removeClippedSubviews. Then the walk cannot change anything, but it still costs main-thread time on every transaction.

The Playground renders a ScrollView with about 4k plain views (no removeClippedSubviews) and a small view above it that updates on every frame (requestAnimationFrame + state). So every frame has one mounting transaction, and every frame walks the 4k views. Tap the text to stop the per-frame updates and compare.

How to see it: run RNTester in Release on iOS, open the Playground, and record the main thread with Instruments (Time Profiler) or sample <pid>. -[UIView(ComponentViewProtocol) updateClippedSubviewsWithClipRect:relativeToView:] and -[CALayer convertRect:toLayer:] show under mountingTransactionDidMount:withSurfaceTelemetry:.

A proposed fix is in #60230.

Changelog:

[INTERNAL] [CHANGED] - RNTester Playground repro for #60227 (not for merge)

Test Plan:

  • prettier@3.10.0 --check with the repo config on the edited file: passes.
  • I did not build RNTester or run Flow (sparse checkout, no full install).
  • I measured the same tree (the Nested component with depth 11 inside a ScrollView, no removeClippedSubviews) on RN 0.88.1 built from source, Release, iOS 26.5 simulator. There the per-frame update came from a Reanimated useAnimatedStyle (opacity), which commits through ShadowTree::commit on the UI thread, instead of the requestAnimationFrame + state update used here. sample <pid> for 10 s:
    • main-thread samples under -[RCTMountingManager performTransaction:]: 908
    • of those, under -[RCTScrollViewComponentView mountingTransactionDidMount:withSurfaceTelemetry:]: 812, all in updateClippedSubviewsWithClipRect:relativeToView: (305 in -[CALayer convertRect:toLayer:])
    • app CPU: 13.8 % of one core.

🤖 Generated with Claude Code

… on every mounting transaction

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@meta-cla

meta-cla Bot commented Nov 23, 2026

Copy link
Copy Markdown

Hi @beqramo!

Thank you for your pull request and welcome to our community.

Action Required

In 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.

Process

In 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 CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla

meta-cla Bot commented Nov 23, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@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 Nov 23, 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 Nov 23, 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

Development

Successfully merging this pull request may close these issues.

1 participant