Skip to content

Commit c412585

Browse files
committed
Merge pull request #820 from ide/remap-docs
[Docs] Add note about JS names for exported methods and RCT_REMAP_METHOD
2 parents 8376e19 + 54dd54c commit c412585

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

docs/NativeModulesIOS.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ var CalendarManager = require('NativeModules').CalendarManager;
5151
CalendarManager.addEvent('Birthday Party', '4 Privet Drive, Surrey');
5252
```
5353

54+
> **NOTE:** JavaScript method names
55+
> The name of the method exported to JavaScript is the native method's name up to the first colon. React Native also defines a macro called `RCT_REMAP_METHOD` to specify the JavaScript method's name. This is useful when multiple native methods are the same up to the first colon and would have conflicting JavaScript names.
56+
5457
The return type of bridge methods is always `void`. React Native bridge is asynchronous, so the only way to pass a result to JavaScript is by using callbacks or emitting events (see below).
5558

5659
## Argument types
@@ -100,7 +103,7 @@ CalendarManager.addEvent('Birthday Party', {
100103
> React Native doesn't provide any guarantees about the types of values in these structures. Your native module might expect an array of strings, but if JavaScript calls your method with an array containing numbers and strings, you'll get `NSArray` with `NSNumber` and `NSString`. It is the developer's responsibility to check array/map value types (see [`RCTConvert`](https://github.com/facebook/react-native/blob/master/React/Base/RCTConvert.h) for helper methods).
101104
102105

103-
# Callbacks
106+
## Callbacks
104107

105108
> **WARNING**
106109
>

0 commit comments

Comments
 (0)