Repository navigation
Description
Description
This is the mechanism suspected in #59166 (closed as stale for lack of runtime evidence), now confirmed at runtime with lldb on RN 0.88.1. Because the prebuilt Release artifacts keep RCTAssert compiled in (#57454), it can crash production apps, not just debug builds.
RCTViewComponentView uses a custom container view when styleWouldClipOverflowInk is true (overflow: hidden plus boxShadow or an outline). prepareForRecycle does not reset _useCustomContainerView, so a recycled view starts its next life with the flag still YES:
updatePropsreadscurrentContainerView, which creates a new_containerView.- The new children mount into that container.
finalizeUpdatessets the flag toNO, theninvalidateLayeradds_backgroundColorLayer/_borderLayerwithaddSublayer:.- The next
currentContainerViewcall tears the container down withaddSubview:, which appends the children after those layers.
From then on insertSubview:atIndex: (which indexes sublayers) puts each new child one slot early, and the native order diverges from the shadow tree. The next index-based unmount fails Attempt to unmount a view which has a different index. With asserts stripped, the child just sits one step lower in the stacking order and VoiceOver reads the siblings out of order.
Runtime evidence (lldb, iOS 27.0 simulator, RN 0.88.1 prebuilt core)
Breakpoints on mountChildComponentView:index: / unmountChildComponentView:index: for one freshly mounted row view (props: backgroundColor, borderTopWidth: 0 with a borderTopColor; no overflow, shadow or outline):
MOUNT child=6722 idx=0 subviews_before=[0] currentContainerView != self <- stale container
MOUNT child=6726 idx=1 subviews_before=[0] currentContainerView != self
addSubview: 6722 (container teardown) subviews_before=[0]
addSubview: 6726 (container teardown) subviews_before=[0,6722]
UNMOUNT child=6726 idx=1 subviews_before=[6722,6726]
MOUNT child=6868 idx=1 subviews_before=[6722] currentContainerView == self
Expected order [6722, 6868]. The row's layer.sublayers afterwards:
[ CALayer zPosition -1024 (background), 6868, CALayer zPosition -1023 (border), 6722 ]
so subviews is [6868, 6722]. The next commit that removes 6868 at index 1 asserts.
In the app, the views that leave the stale flag behind are cards with overflow: 'hidden' + boxShadow in a swipeable carousel, where each swipe unmounts some cards. A typical repro: about 5 swipe/tap rounds trips the assert in a debug build. Moving the shadow to an outer view and the clip to an inner view makes it go away; after that change, no view in the app holds a custom container.
strings React.xcframework/ios-arm64/React.framework/React on react-native-artifacts-0.88.1-reactnative-core-release.tar.gz still contains Attempt to unmount a view which has a different index, so #57454 applies to 0.88.1.
Steps to reproduce
- Render a
Viewwithoverflow: 'hidden'and aboxShadow, then unmount it, so its native view goes to the recycle pool. - Mount a new
Viewwith abackgroundColor(separate background layer) or a non-uniform border, holding two or more children, so it may dequeue that recycled view. - In a later commit, replace a non-first child (for example by changing its
key). - In a later commit again, remove that child.
I haven't built a standalone reproducer; the evidence above comes from an app. Happy to run a candidate repro or add more lldb output.
Suggested fix
- Reset
_useCustomContainerView = NO(and drop any_containerView) inprepareForRecycle. - When tearing the container down, insert its subviews at the container's position (for example
insertSubview:belowSubview:_containerView) instead of appending them after other sublayers.
Workaround
Never combine overflow: hidden with boxShadow or an outline on one view: shadow on an outer view, clip on an inner one.
React Native Version
0.88.1
Affected Platforms
Runtime - iOS
Areas
Fabric - The New Renderer
Output of npx react-native info
react-native: 0.88.1 (prebuilt React Native core), Expo SDK 58, New Architecture, Hermes
iOS 27.0 simulator, Xcode 27.1
Stacktrace or Logs
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Attempt to unmount a view which has a different index. (parent: <RCTViewComponentView ...>, child: <RCTParagraphComponentView ...>, ...)'
React _RCTAssertFormat
React -[RCTViewComponentView unmountChildComponentView:index:]
React RCTPerformMountInstructions(...)
React -[RCTMountingManager performTransaction:]
React facebook::react::TelemetryController::pullTransaction(...)
React -[RCTMountingManager initiateTransaction:]
Reproducer
No standalone reproducer yet (see Steps to reproduce).
Activity
react-native-bot commentedon Nov 19, 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.
Repro for react#60140: recycled view keeps its custom container (iOS)
marvin-splitt commentedon Nov 19, 2026
Reproducer: #60141 edits
RNTesterPlayground.js.Four taps on one screen, deterministic on RN 0.88.1 (iOS 27.0 simulator, debug):
Viewwithoverflow: 'hidden'+boxShadow, so its native view goes to the recycle pool.View(collapsable={false},borderTopWidth) with two absolutely positioned children. It dequeues the recycled view and mounts the children through the stale container.key). It lands behind the first one: the green square is hidden under the red box.Attempt to unmount a view which has a different index.Crashed in 2 of 2 runs. With the
boxShadowremoved from the first view (control), all four steps render correctly and nothing asserts.On main and
v0.89.0-rc.2,prepareForRecyclestill doesn't reset_useCustomContainerView. debaf42 (#59628) reconciles the container before the ownership check inunmountChildComponentView:index:, but doesn't change where the children end up, so the index assertion and the wrong stacking order should remain. I haven't run the reproducer on main.