Fix code example: NSNumber should be marked nonnull for compatibility with Android

Summary:
I was following the Native Modules guide for iOS, when I noticed this error in the example code:

> Argument 2 (NSNumber) of CalendarManager.addEvent has unspecified nullability but React requires that all NSNumber arguments are explicitly marked as `nonnull` to ensure compatibility with Android.

Marking the parameter NSNumber type as `nonnull` fixes the error in the example.
Closes https://github.com/facebook/react-native/pull/9705

Differential Revision: D3804661

Pulled By: JoelMarcey

fbshipit-source-id: 92ec8a08ff2a179e4a8935de4cecd7b8d993469b
This commit is contained in:
Arian Stolwijk 2016-09-01 08:39:20 -07:00 committed by Facebook Github Bot 4
parent bcf48e74ae
commit a02c238464

View File

@ -78,7 +78,7 @@ But it also works with any type that is supported by the `RCTConvert` class (see
In our `CalendarManager` example, we need to pass the event date to the native method. We can't send JavaScript Date objects over the bridge, so we need to convert the date to a string or number. We could write our native function like this:
```objective-c
RCT_EXPORT_METHOD(addEvent:(NSString *)name location:(NSString *)location date:(NSNumber *)secondsSinceUnixEpoch)
RCT_EXPORT_METHOD(addEvent:(NSString *)name location:(NSString *)location date:(nonnull NSNumber *)secondsSinceUnixEpoch)
{
NSDate *date = [RCTConvert NSDate:secondsSinceUnixEpoch];
}