From a02c2384645cffee5f8bcc2bd71c38c37b0f2e02 Mon Sep 17 00:00:00 2001 From: Arian Stolwijk Date: Thu, 1 Sep 2016 08:39:20 -0700 Subject: [PATCH] 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 --- docs/NativeModulesIOS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/NativeModulesIOS.md b/docs/NativeModulesIOS.md index b769cfd4e..a12818eb9 100644 --- a/docs/NativeModulesIOS.md +++ b/docs/NativeModulesIOS.md @@ -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]; }