Skip to content

DeviceEventEmitter example in tutorial fails #394

@mpj

Description

@mpj

There is an issue with the tutorial, with the sendAppEventWithName call.
Screenshot of issue
From: https://facebook.github.io/react-native/docs/nativemodulesios.html

This example code will fail with this problem:
Screenshot of issue
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...

[_bridge enqueueJSCall:@"RCTNativeAppEventEmitter.emit"

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions