Skip to content

UIViewControllerHierarchyInconsistency crash when RCT_NEW_ARCH_ENABLED=1 on iOS #3233

@mpawar-ep-910

Description

@mpawar-ep-910

Description

When running a React Native app with New Architecture enabled (RCT_NEW_ARCH_ENABLED=1), the app crashes on iOS with the following error:

Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency',
reason: 'child view controller:<RNSViewController: 0x10737c1d0> should have parent
view controller:(null) but actual parent is:<RNSScreen: 0x10988a400>'

This issue does not occur when running with Old Architecture (RCT_NEW_ARCH_ENABLED=0).

Crash Log (truncated):

*** First throw call stack:
(
0 CoreFoundation __exceptionPreprocess + 172
1 libobjc.A.dylib objc_exception_throw + 72
2 UIKitCore -[UIView(Hierarchy) _associatedViewControllerForwardsAppearanceCallbacks...]
3 UIKitCore -[UIView(Hierarchy) _willMoveToWindow:withAncestorView:]
4 UIKitCore -[UIView(Internal) _addSubview:positioned:relativeTo:]
...
libc++abi: terminating due to uncaught exception of type NSException
)

Steps to reproduce

Create a new React Native project or upgrade to RN 0.77.0.

Install the following dependencies:

"react-native": "0.77.0",
"react-native-screens": "4.5.0",
"react-native-gesture-handler": "2.22.1",
"react-native-reanimated": "3.18.0",
"expo": "52.0.0"

Enable New Architecture by setting RCT_NEW_ARCH_ENABLED=1.

Run the iOS app.

Observe crash during navigation transitions.

Snack or a link to a repository

None

Screens version

4.5.0

React Native version

0.77.0

Platforms

iOS

JavaScript runtime

None

Workflow

None

Architecture

None

Build type

Debug mode

Device

iOS simulator

Device model

iPhone 16 Pro

Acknowledgements

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Missing reproThis issue need minimum repro scenarioPlatform: iOSThis issue is specific to iOS

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions