Clarify JavaScript module naming edge case
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 https://github.com/facebook/react-native/pull/14903 Differential Revision: D5390343 Pulled By: hramos fbshipit-source-id: 73667d703b097e70e15ff42c54b7ccc6b480104f
This commit is contained in:
parent
c00abe53c3
commit
dec62ffc3e
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue