App crashes on reload.
```2017-07-17 11:53:30.917 [info][tid:com.facebook.react.JavaScript] Running application "navigation.appname.root" with appParams: {"rootTag":1,"initialProps":{"containerId":"Container2"}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF
2017-07-17 11:53:30.925 AppName[11327:101435] * Assertion failure in -RCTEventEmitter sendEventWithName:body:, ..../node_modules/react-native/React/Modules/RCTEventEmitter.m:42
2017-07-17 11:53:30.942 AppName[11327:101435] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'bridge is not set. This is probably because you've explicitly synthesized the bridge in RNNEventEmitter, even though it's inherited from RCTEventEmitter.'
Warning diplayed on startup:
Sending RNN.appLaunched
with no listeners registered.
logToConsole @ index.ios.bundle:12332
logIfNoNativeHook @ index.ios.bundle:12315
__callFunction @ index.ios.bundle:5070
(anonymous) @ index.ios.bundle:4911
__guard @ index.ios.bundle:5044
callFunctionReturnFlushedQueue @ index.ios.bundle:4910
(anonymous) @ debuggerWorker.js:71
```
Just configure the library with the default react native init app.
I know next to nothing about react native or react native navigation, so this may well be a terrible way to solve the problem.
That said, making the following change in ReactNativeNavigation/RNNEventEmitter.m seems to work, so if this is killing your productivity you can roll with this till a more official solution comes through.
# Before
-(void)send:(NSString *)eventName body:(id)body {
[self sendEventWithName:eventName body:body];
}
# After
-(void)send:(NSString *)eventName body:(id)body {
if (self.bridge)
{
[self sendEventWithName:eventName body:body];
}
}
@rustybox's solution worked for me. Before implementing the check for self.bridge
the console log after crash in Xcode was:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException',
reason: 'bridge is not set. This is probably because you've explicitly synthesized
the bridge in RNNEventEmitter, even though it's inherited from RCTEventEmitter.'
Create PR based on @rustybox 's comment: https://github.com/wix/react-native-navigation/pull/1836
Working with react-native 0.51.0 on top of latest version of v2, when tried @joonhocho 's fix, I get this error:
2017-12-22 02:46:10.229 [info][tid:main][RCTCxxBridge.mm:213] Initializing <RCTCxxBridge: 0x1c01d00e0> (parent: <RCTBridge: 0x1c00c9e60>, executor: (null))
2017-12-22 02:46:10.232118+0300 faida[927:391773] Initializing <RCTCxxBridge: 0x1c01d00e0> (parent: <RCTBridge: 0x1c00c9e60>, executor: (null))
2017-12-22 02:46:10.257 [warn][tid:main][RCTBridge.m:121] Class RCTCxxModule was not exported. Did you forget to use RCT_EXPORT_MODULE()?
2017-12-22 02:46:10.257259+0300 faida[927:391773] Class RCTCxxModule was not exported. Did you forget to use RCT_EXPORT_MODULE()?
2017-12-22 02:46:10.339 [info][tid:main][RCTCxxBridge.mm:905] Invalidating <RCTCxxBridge: 0x1c01d00e0> (parent: <RCTBridge: 0x1c00c9e60>, executor: RCTWebSocketExecutor)
2017-12-22 02:46:10.339276+0300 faida[927:391773] Invalidating <RCTCxxBridge: 0x1c01d00e0> (parent: <RCTBridge: 0x1c00c9e60>, executor: RCTWebSocketExecutor)
2017-12-22 02:46:10.339 [info][tid:main][RCTCxxBridge.mm:213] Initializing <RCTCxxBridge: 0x1d01d0d10> (parent: <RCTBridge: 0x1c00c9e60>, executor: RCTWebSocketExecutor)
2017-12-22 02:46:10.339443+0300 faida[927:391773] Initializing <RCTCxxBridge: 0x1d01d0d10> (parent: <RCTBridge: 0x1c00c9e60>, executor: RCTWebSocketExecutor)
2017-12-22 02:46:11.216 [warn][tid:main][RCTEventEmitter.m:54] Sending `RNN.appLaunched` with no listeners registered.
2017-12-22 02:46:11.216052+0300 faida[927:391773] Sending `RNN.appLaunched` with no listeners registered.
On the debug screen I see:
index.bundle:14839 Sending `RNN.appLaunched` with no listeners registered.
logToConsole @ index.bundle:14839
logIfNoNativeHook @ index.bundle:14822
__callFunction @ index.bundle:2100
(anonymous) @ index.bundle:1929
__guard @ index.bundle:2071
callFunctionReturnFlushedQueue @ index.bundle:1928
(anonymous) @ debuggerWorker.js:72
index.bundle:14839 Invalidating <RCTCxxBridge: 0x1d01d0d10> (parent: <RCTBridge: 0x1c00c9e60>, executor: (null))
Most helpful comment
I know next to nothing about react native or react native navigation, so this may well be a terrible way to solve the problem.
That said, making the following change in ReactNativeNavigation/RNNEventEmitter.m seems to work, so if this is killing your productivity you can roll with this till a more official solution comes through.