React Native Navigation与Yarn Workspace集成时应用崩溃问题排查求助
I've run into a frustrating crash issue after adding React Native Navigation (RNN) to my React Native project that uses Yarn Workspaces. I tested multiple times both with and without Yarn Workspaces enabled, and confirmed the problem is directly tied to the Workspace configuration. I've also put together a reproduction project to help diagnose the issue.
Reproduction Steps
- Initialize a React Native project
- Set up a Yarn Workspace with 2 packages (check the
package.jsonandmetro.config.jsin the reproduction project for details) - Run
yarn add react-native-navigationin one of the packages - Execute
npx rnn-link(all steps reported success) - Modify
index.jsto let RNN handle app initialization and configure a basic route - Run
pod install - Launch the project via Xcode or
yarn android
Expected Behavior
The app should launch and run normally on both Android and iOS platforms.
Actual Behavior
- Android: Shows a black screen instead of the splash screen, then crashes after a few seconds with a flood of error logs
- iOS: Crashes even faster, with core error logs matching Android's:
ERROR Invariant Violation: No callback found with cbID 0 and callID 0 for module <unknown>. Args: '[{"app_state":"active"}]' ERROR Invariant Violation: No callback found with cbID 6 and callID 3 for module <unknown>. Args: '[{"app_state":"active"}]' ERROR Invariant Violation: No callback found with cbID 60 and callID 30 for module <unknown>. Args: '["{\"codeFrame\":{\"content\":\"\\u001b[0m \\u001b[90m 36 |\\u001b[39m \\u001b[36mvar\\u001b[39m args \\u00...(truncated)..."}]'
(A large number of identical repeated errors follow these)
I also see this log line before the crash: LOG Running "com.myApp.WelcomeScreen" with {"initialProps":{"componentId":"Component1"},"rootTag":1}
Environment Details
- React Native Navigation version: 7.14.0
- React Native version: 0.64.0
- Tested devices: Xiaomi Redmi Note 7, Android Emulator, Xcode Simulator
My hunch is that something's off with the Yarn Workspace configuration, but the setup works perfectly fine when RNN isn't integrated. Could anyone share some troubleshooting tips or potential fixes?
内容的提问来源于stack exchange,提问作者jeremy_kanso

