Skip to content

Commit

Permalink
Merge pull request facebook#820 from ide/remap-docs
Browse files Browse the repository at this point in the history
[Docs] Add note about JS names for exported methods and RCT_REMAP_METHOD
  • Loading branch information
frantic committed Apr 12, 2015
2 parents 8376e19 + 54dd54c commit c412585
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/NativeModulesIOS.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ var CalendarManager = require('NativeModules').CalendarManager;
CalendarManager.addEvent('Birthday Party', '4 Privet Drive, Surrey');
```

> **NOTE:** JavaScript method names
> 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.
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).

## Argument types
Expand Down Expand Up @@ -100,7 +103,7 @@ CalendarManager.addEvent('Birthday Party', {
> 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).

# Callbacks
## Callbacks

> **WARNING**
>
Expand Down

0 comments on commit c412585

Please sign in to comment.