DeviceEventEmitter example in tutorial fails
There is an issue with the tutorial, with the sendAppEventWithName call.
From: https://facebook.github.io/react-native/docs/nativemodulesios.html
This example code will fail with this problem:
Text for search engine: "Requiring unknown module "RCTNativeAppEventEmitter". If you are sure the modules is there, try restarting the packager.
This is because this call... https://github.com/facebook/react-native/blob/72d3d724a3a0c6bc46981efd0dad8f7f61121a47/React/Base/RCTEventDispatcher.m#L39
Will eventually hit this line, where the error occurs, because there is no RCTNativeAppEventEmitter in the dependency tree. I guess this is because the JavaScript in the example is using the DeviceEventEmitter which is actually requiring the RCTDeviceEventEmitter, not the RCTAppEventEmitter which I cannot find anywhere in the JS code?
Changing the example Objective-C to call sendDeviceEventWithName instead of sendAppEventWithName fixes the problem.
:+1: sendDeviceEventWithName works for me as well
Seems like #918 is a fix so you can still RCTAppEventEmitter but for now I'm also using the DeviceEventEmitter. It would be good to know what the purpose of the two separate emitters is meant to be...
sendDeviceEventWithName works for me too. thanks
Fixed now!