From 136daf8eee607d7c512b04f0aa4f957b25aeb63a Mon Sep 17 00:00:00 2001 From: Travis CI Date: Fri, 3 Apr 2015 17:07:10 +0000 Subject: [PATCH] update website --- css/react-native.css | 4 ---- docs/nativemodulesios.html | 6 +++--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/css/react-native.css b/css/react-native.css index 7322f872514..e11863ab23b 100644 --- a/css/react-native.css +++ b/css/react-native.css @@ -700,10 +700,6 @@ figure { width: 650px; } -.inner-content a { - word-break: break-word; -} - .nosidebar .inner-content { float: none; margin: 0 auto; diff --git a/docs/nativemodulesios.html b/docs/nativemodulesios.html index 740c4c1da2a..96416358d6b 100644 --- a/docs/nativemodulesios.html +++ b/docs/nativemodulesios.html @@ -28,7 +28,7 @@ CalendarManager.: '4 Privet Drive, Surrey', time: date.toTime(), description: '...' -})

NOTE: About array and map

React Native doesn't provide any guarantees about the types of values in these structures. Your native module might expect array of strings, but if JavaScript calls your method with an array that contains number and string you'll get NSArray with NSNumber and NSString. It's the developer's responsibility to check array/map values types (see RCTConvert for helper methods).

Callbacks #

WARNING

This section is even more experimental than others, we don't have a set of best practices around callbacks yet.

Native module also supports a special kind of argument - callback. In most cases it is used to provide function call result to JavaScript.

- (void)findEvents:(RCTResponseSenderBlock)callback +})

NOTE: About array and map

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 for helper methods).

Callbacks #

WARNING

This section is even more experimental than others, we don't have a set of best practices around callbacks yet.

Native module also supports a special kind of argument - callback. In most cases it is used to provide function call result to JavaScript.

- (void)findEvents:(RCTResponseSenderBlock)callback { RCT_EXPORT(); NSArray *events = ... @@ -51,12 +51,12 @@ CalendarManager.}

The same way if the operation can take a long time to complete, the native module should not block. It is a good idea to use dispatch_async to schedule expensive work on background queue.

Exporting constants #

Native module can export constants that are instantly available to JavaScript at runtime. This is useful to export some initial data that would otherwise require a bridge round-trip.

- (NSDictionary *)constantsToExport { return @{ @"firstDayOfTheWeek": @"Monday" }; -}

JavaScript can use this value right away:

console.log(CalendarManager.firstDayOfTheWeek);

Note that the constants are exported only at initialization time, so if you change constantsToExport value at runtime it won't affect JavaScript environment.

Sending events to JavaScript #

The native module can signal events to JavaScript without being invoked directly. The easiest way to do this is to use eventDispatcher:

#import "RCTBridge.h" +}

JavaScript can use this value right away:

console.log(CalendarManager.firstDayOfTheWeek);

Note that the constants are exported only at initialization time, so if you change constantsToExport value at runtime it won't affect JavaScript environment.

Sending events to JavaScript #

The native module can signal events to JavaScript without being invoked directly. The easiest way to do this is to use eventDispatcher:

#import "RCTBridge.h" #import "RCTEventDispatcher.h" @implementation CalendarManager -@synthesize bridge = _bridge; +@synthesize bridge = _bridge; - (void)calendarEventReminderReceived:(NSNotification *)notification {