Skip to content

Commit

Permalink
Clarify JavaScript module naming edge case
Browse files Browse the repository at this point in the history
Summary:
I've been burned by https://stackoverflow.com/questions/35052565/undefined-is-not-an-object-from-native-module-in-react-native/36580178 a few times, when I name a native module with RCT prefix. This will hopefully save me and others from that pain in the future.

<!--
Thank you for sending the PR!

If you changed any code, please provide us with clear instructions on how you verified your changes work. In other words, a test plan is *required*. Bonus points for screenshots and videos!

Please read the Contribution Guidelines at https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md to learn more about contributing to React Native.

Happy contributing!
-->
Closes #14903

Differential Revision: D5390343

Pulled By: hramos

fbshipit-source-id: 73667d703b097e70e15ff42c54b7ccc6b480104f
  • Loading branch information
lyahdav authored and facebook-github-bot committed Jul 10, 2017
1 parent c00abe5 commit dec62ff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/NativeModulesIOS.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ A native module is just an Objective-C class that implements the `RCTBridgeModul
@end
```

In addition to implementing the `RCTBridgeModule` protocol, your class must also include the `RCT_EXPORT_MODULE()` macro. This takes an optional argument that specifies the name that the module will be accessible as in your JavaScript code (more on this later). If you do not specify a name, the JavaScript module name will match the Objective-C class name.
In addition to implementing the `RCTBridgeModule` protocol, your class must also include the `RCT_EXPORT_MODULE()` macro. This takes an optional argument that specifies the name that the module will be accessible as in your JavaScript code (more on this later). If you do not specify a name, the JavaScript module name will match the Objective-C class name. If the Objective-C class name begins with RCT, the JavaScript module name will exclude the RCT prefix.

```objectivec
// CalendarManager.m
Expand Down

0 comments on commit dec62ff

Please sign in to comment.