[ReactNative] Use RCTNullIfNill and (id)kCFNull

Summary:
@public

Use consistent `null` handling:

`value || null`                ->  `RCTNullIfNil(value)`
`value == null ? nil : value`  ->  `RCTNilIfNull(value)`
`[NSNull null]`                ->  `(id)kCFNull`

Test Plan: The tests should be enough.
This commit is contained in:
Tadeu Zagallo
2015-06-12 11:05:01 -07:00
parent 696b31f1a4
commit 2a7adfb815
13 changed files with 41 additions and 37 deletions

View File

@@ -11,6 +11,7 @@
#import "RCTBridge.h"
#import "RCTEventDispatcher.h"
#import "RCTUtils.h"
NSString *const RCTOpenURLNotification = @"RCTOpenURLNotification";
@@ -76,7 +77,7 @@ RCT_EXPORT_METHOD(canOpenURL:(NSURL *)URL
- (NSDictionary *)constantsToExport
{
NSURL *initialURL = _bridge.launchOptions[UIApplicationLaunchOptionsURLKey];
return @{@"initialURL": [initialURL absoluteString] ?: [NSNull null]};
return @{@"initialURL": RCTNullIfNil([initialURL absoluteString])};
}
@end