mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Back out "[react-native][PR] [iOS] Add convert compatible of NSString for bridge message data"
Summary: Original commit changeset: 4849a8e94141 # Problem: This diff caused https://github.com/facebook/react-native/issues/25339. It was converting non string values to strings whenever the conversion was available. The original problem that this diff was trying to solve is described here -> https://twitter.com/estevao_lucas/status/1117572702083190785?s=215 # Solution introduced by this diff This diff introduced a conversion. So for any value that was meant to be string but wasn't we would attempt to convert it. Which is not always wanted. # Solution for problem in the twitter I think we should improve the error message if incorrect type is being passed as a prop. However this isn't a problem if views are Flow typed. Reviewed By: cpojer Differential Revision: D15964298 fbshipit-source-id: 3d027a378561b87e7a9e89fc5e39dc6f359d8d22
This commit is contained in:
committed by
Facebook Github Bot
parent
004a90b131
commit
df17ebfcfa
+1
-10
@@ -53,21 +53,12 @@ RCT_NUMBER_CONVERTER(NSUInteger, unsignedIntegerValue)
|
||||
|
||||
RCT_JSON_CONVERTER(NSArray)
|
||||
RCT_JSON_CONVERTER(NSDictionary)
|
||||
RCT_JSON_CONVERTER(NSString)
|
||||
RCT_JSON_CONVERTER(NSNumber)
|
||||
|
||||
RCT_CUSTOM_CONVERTER(NSSet *, NSSet, [NSSet setWithArray:json])
|
||||
RCT_CUSTOM_CONVERTER(NSData *, NSData, [json dataUsingEncoding:NSUTF8StringEncoding])
|
||||
|
||||
+ (NSString *)NSString:(id)json
|
||||
{
|
||||
if ([json isKindOfClass:NSString.class]) {
|
||||
return json;
|
||||
} else if (json && json != (id)kCFNull) {
|
||||
return [NSString stringWithFormat:@"%@",json];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (NSIndexSet *)NSIndexSet:(id)json
|
||||
{
|
||||
json = [self NSNumberArray:json];
|
||||
|
||||
Reference in New Issue
Block a user