mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-28 12:15:37 +08:00
[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:
@@ -54,7 +54,7 @@ RCT_CONVERTER(NSString *, NSString, description)
|
||||
RCTLogConvertError(json, "a number");
|
||||
}
|
||||
return number;
|
||||
} else if (json && json != [NSNull null]) {
|
||||
} else if (json && json != (id)kCFNull) {
|
||||
RCTLogConvertError(json, "a number");
|
||||
}
|
||||
return nil;
|
||||
@@ -141,7 +141,7 @@ RCT_CONVERTER(NSString *, NSString, description)
|
||||
"Expected format: YYYY-MM-DD'T'HH:mm:ss.sssZ", json);
|
||||
}
|
||||
return date;
|
||||
} else if (json && json != [NSNull null]) {
|
||||
} else if (json && json != (id)kCFNull) {
|
||||
RCTLogConvertError(json, "a date");
|
||||
}
|
||||
return nil;
|
||||
|
||||
Reference in New Issue
Block a user