software-mansion / software-mansion/react-native-screens
UIViewControllerHierarchyInconsistency crash when RCT_NEW_ARCH_ENABLED=1 on iOS
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 3.7k
- Forks
- 714
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 71
Description
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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the crash in a React Native 0.77.0 app using react-native-screens 4.5.0 and RCT_NEW_ARCH_ENABLED=1 on the iOS simulator. Start with the navigation transition that triggers the UIViewControllerHierarchyInconsistency error and compare it with the old architecture. Done means the supplied dependency set no longer crashes during iOS navigation transitions under the new architecture.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, react-native
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 45/100