Repository navigation
Description
Description
On iOS with the New Architecture, every mounted ScrollView walks its entire native subtree after every mounting transaction on the surface, even when no view in that subtree sets removeClippedSubviews. Each level of the walk does a -[UIView convertRect:toView:]. With a large tree under a ScrollView (iPad layouts, long lists of cards) this costs seconds of main-thread time; when commits come every frame (Reanimated UI-thread commits, or back-to-back React commits) it runs every frame.
Code path (0.88.0, unchanged on main):
RCTScrollViewComponentView.mm–mountingTransactionDidMount:withSurfaceTelemetry:calls[self _remountChildren]unconditionally (0.88.0 line ~292)._remountChildren(0.88.0 line ~1005) calls[_scrollView updateClippedSubviewsWithClipRect:… relativeToView:_scrollView]; it is only skipped when theenableViewCullingfeature flag is on (defaultfalse).RCTViewComponentView.mmupdateClippedSubviewsWithClipRect:relativeToView:(~299–304): when_removeClippedSubviewsis NO it falls through tosuper.UIView+ComponentViewProtocol.mm(~164–174): the default implementation doesclipRect = [clipView convertRect:clipRect toView:self]and recurses into every subview "in case any of those do support it".
So in an app that never uses removeClippedSubviews, every commit pays a full convertRect traversal of every ScrollView's content, and the walk can never clip anything.
Suggested fix: skip the walk when nothing below can use it. For example, track whether any descendant has removeClippedSubviews (a count maintained in RCTViewComponentView when the prop changes / the view mounts and unmounts) and return early from _remountChildren when it is zero; or only recurse into subviews that are, or contain, a clipping view. Running _remountChildren from mountingTransactionDidMount only when the transaction contains mutations under this ScrollView would also cut most of the cost.
Steps to reproduce
- iOS, New Architecture, release build.
- Render a
ScrollViewwith a deep/wide subtree (a few thousand plainViews), withoutremoveClippedSubviews. - Elsewhere on the same surface, commit an update every frame (e.g. a Reanimated
useAnimatedStyledrivingopacity, which commits throughShadowTree::commiton the UI thread, or a JSsetStateinrequestAnimationFrame). - Profile the main thread with Instruments (Time Profiler):
-[UIView(ComponentViewProtocol) updateClippedSubviewsWithClipRect:relativeToView:]and-[CALayer convertRect:toLayer:]dominate, called from-[RCTScrollViewComponentView mountingTransactionDidMount:withSurfaceTelemetry:], although nothing is clipped.
import { useEffect } from 'react';
import { ScrollView, View } from 'react-native';
import Animated, { useAnimatedStyle, useSharedValue, withRepeat, withTiming } from 'react-native-reanimated';
function Nested({ depth }: { depth: number }) {
if (depth === 0) return <View style={{ height: 4, backgroundColor: '#ccc', margin: 1 }} />;
return (
<View style={{ padding: 1 }}>
<Nested depth={depth - 1} />
<Nested depth={depth - 1} />
</View>
);
}
export default function App() {
const o = useSharedValue(1);
useEffect(() => { o.value = withRepeat(withTiming(0, { duration: 500 }), -1, true); }, []);
const style = useAnimatedStyle(() => ({ opacity: o.value }));
return (
<View style={{ flex: 1 }}>
<Animated.View style={[{ height: 40, backgroundColor: 'tomato' }, style]} />
<ScrollView>
<Nested depth={11} />{/* ~4k views */}
</ScrollView>
</View>
);
}React Native Version
0.88.0 (also seen on 0.86.2; the code is unchanged on main)
Affected Platforms
Runtime - iOS
Output of npx @react-native-community/cli info
react-native: 0.88.0 (prebuilt React core, New Architecture)
expo: 58.0.14
react-native-reanimated: 4.7.1 (react-native-worklets)
Hermes
iOS / iPadOS: 16.7 – 27.0.1 on device (see below)
Built with Xcode / iPhoneOS 27.1 SDK on EAS
Stacktrace or Logs
Two production groups in our app, same leaf.
(a) Main-thread App Hang, 5–6 s, fully blocked (React commits from JS; 267 events / 188 users since May 2026, still occurring):
-[RCTMountingManager initiateTransaction:]
-[RCTMountingManager performTransaction:]
facebook::react::TelemetryController::pullTransaction
RCTMountingTransactionObserverCoordinator::notifyObserversMountingTransactionDidMount
-[RCTScrollViewComponentView mountingTransactionDidMount:withSurfaceTelemetry:]
-[UIView(ComponentViewProtocol) updateClippedSubviewsWithClipRect:relativeToView:]
-[UIView(ComponentViewProtocol) updateClippedSubviewsWithClipRect:relativeToView:]
-[RCTViewComponentView updateClippedSubviewsWithClipRect:relativeToView:]
-[UIView(ComponentViewProtocol) updateClippedSubviewsWithClipRect:relativeToView:]
-[RCTViewComponentView updateClippedSubviewsWithClipRect:relativeToView:]
... (alternating, ~10 levels)
-[UIView(ComponentViewProtocol) updateClippedSubviewsWithClipRect:relativeToView:]
-[UIView(Geometry) convertRect:toView:]
-[CALayer convertRect:toLayer:]
CA::Layer::map_geometry
(b) MetricKit CPU exception ("totalCPUTime: 90 sec, totalSampledTime: 175 sec"), driven every frame by Reanimated (202 events / 170 users since Oct 2026):
CA::Display::DisplayLink::dispatch_items
-[AnimationFrameQueue executeQueue:] (react-native-worklets)
worklets::AnimationFrameBatchinator::flush
... worklet runtime / Hermes ...
-[REANodesManager performOperations]
reanimated::ReanimatedModuleProxy::performOperations
reanimated::ReanimatedModuleProxy::commitUpdates
facebook::react::ShadowTree::commit
facebook::react::ShadowTree::tryCommit
facebook::react::ShadowTree::mount
facebook::react::UIManager::shadowTreeDidFinishTransaction
facebook::react::Scheduler::uiManagerDidFinishTransaction
-[RCTSurfacePresenter schedulerShouldRenderTransactions:]
-[RCTMountingManager performTransaction:]
RCTMountingTransactionObserverCoordinator::notifyObserversMountingTransactionDidMount
-[RCTScrollViewComponentView mountingTransactionDidMount:withSurfaceTelemetry:]
-[UIView(ComponentViewProtocol) updateClippedSubviewsWithClipRect:relativeToView:]
-[RCTViewComponentView updateClippedSubviewsWithClipRect:relativeToView:]
... (alternating)
-[UIView(Geometry) convertRect:toView:]
-[CALayer convertRect:toLayer:]
CA::Layer::map_geometry
CA::Mat4Impl::mat4_unapply_inverse_to_point2
Devices: mostly iPads. (a) iPad13,18 40, iPad12,1 31, iPad15,7 23, iPhone14,5 19, iPad13,16 12; iOS 27.0.1, 26.5–26.6.2, 18.x, 17.7.11, 16.7.16. (b) is concentrated on 2-core iPads: iPad7,11 72, iPad7,5 48, then iPad7,3/7,4/7,6/7,12, iPad11,6.
Our app sets removeClippedSubviews nowhere, so every one of these walks is a no-op apart from its cost; the alternating RCTViewComponentView / UIView(ComponentViewProtocol) frames are the pass-through path described above.
MANDATORY Reproducer
Inline snippet above (no public repo yet). The data comes from production hang/CPU telemetry in our production app; the code path is visible directly in the files referenced above.
Screenshots and Videos
No response
Activity
react-native-bot commentedon Nov 23, 2026
Warning
Missing reproducer: We could not detect a reproducible example in your issue report. Reproducers are mandatory and we can accept only one of those as a valid reproducer:
You can read more about about it on our website: How to report a bug.
beqramo commentedon Nov 23, 2026
Reproducer, as requested by the bot, plus a proposed fix:
removeClippedSubviews) and a small view updated every frame. Profile the main thread: the time is inupdateClippedSubviewsWithClipRect:relativeToView:undermountingTransactionDidMount:withSurfaceTelemetry:.RCTViewComponentViewcounts views withremoveClippedSubviews;RCTScrollViewComponentView._remountChildrenreturns early when the count is zero. With a clipping view mounted, behavior is unchanged.Measured on RN 0.88.1 built from source (Release, iOS 26.5 simulator), same tree with a Reanimated opacity animation,
samplefor 10 s: main-thread samples in-[RCTMountingManager performTransaction:]went from 908 (809 of them in the clipping walk) to 50; app CPU from 13.8 % to 2.9 %. Clipping still detaches/reattaches rows correctly when aremoveClippedSubviewsScrollView is mounted. Details in the PRs.beqramo commentedon Nov 23, 2026
Production data confirming the Reanimated path described above. Environment: RN 0.88.0 (Fabric, Hermes), Reanimated 4.7.1, worklets 0.13.0, no
removeClippedSubviews.Sentry recorded 98 "App Hang" events of 2.1–2.9 s each in the last month, from 49 users. 86 of them come from the iPad app running on Apple-silicon Macs (Mac Catalyst). The other 12 come from iPads and iPhones on iOS 17.5 through 27.0. On the main thread, the walk runs inside a Reanimated UI-thread commit started by a display-link frame. No React commit is involved:
So every Reanimated frame that commits pays the whole-subtree
convertRectwalk synchronously, inside the display-link callback. In the latest Mac event, the frame arrived inside AppKit'sNSCorrectionPanelnested event loop, triggered by the autocorrect panel while typing. The animation keeps committing during that loop. The early return in #60230 would remove this whole path for apps without clipping views.