react-native-navigation
react-native-navigation copied to clipboard
[V7] [IOS] App is stuck on the black screen after making reload on debug mode, my code base is use Swift
🐛 Bug Report
After upgrade from "6.12.0" to "^7.28.0" i got black screen after reloading the package.
To Reproduce
- build the debug app
- after opening app try to reload package
- got black screen instead of root screen
Expected behavior
should be the root screen appear after reload package
Actual Behavior
black screen appear after reloading
https://user-images.githubusercontent.com/16348512/177050978-e59f9b9f-0e8f-447c-968b-2bdfb2a4e3ea.mov
Your Environment
- React Native Navigation version: "^7.28.0"
- React Native version: "0.66.3"
- Platform: IOS "swift" code base
- Device info (Simulator/Device? OS version? Debug/Release?): Simulator / 14.5 / Debug
Reproducible Demo
https://github.com/AbdelhalimAhmed/react-native-navigation-investegate-issue
References
I quoted my code according this comment https://github.com/wix/react-native-navigation/issues/6561#issuecomment-690044100
same issue
The setup in my app is a bit different as I have a separate view controller class to the AppDelegate that is also the ReactBridgeDelegate however the issue remains the same, it's to do with weak references.
If you look at the RCTBridge.h file, the property for delegate is marked as weak.
In your setup you were passing RNModuleInitialiser.init() directly to ReactNativeNavigation.bootstrap which would exist in stack memory for the duration of the bootstrap call but would be removed as the call ended. By making the AppDelegate the RCTBridgeDelegate in your sample repo https://github.com/AbdelhalimAhmed/react-native-navigation-investegate-issue/pull/1/files the reference in RCTBridge won't be removed as AppDelegate exists in memory for the lifetime of the app so when the reload command is run and the bridge reloads it still has a reference to the ReactBridgeDelegate in order to correctly bootstrap itself again with the extraModules RNN provides/requires.