Skip to content

Commit df17ebf

Browse files
sammy-SCfacebook-github-bot
authored andcommitted
Back out "[react-native][PR] [iOS] Add convert compatible of NSString for bridge message data"
Summary: Original commit changeset: 4849a8e94141 # Problem: This diff caused facebook#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
1 parent 004a90b commit df17ebf

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

React/Base/RCTConvert.m

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,21 +53,12 @@ + (type *)type:(id)json { return json; }
5353

5454
RCT_JSON_CONVERTER(NSArray)
5555
RCT_JSON_CONVERTER(NSDictionary)
56+
RCT_JSON_CONVERTER(NSString)
5657
RCT_JSON_CONVERTER(NSNumber)
5758

5859
RCT_CUSTOM_CONVERTER(NSSet *, NSSet, [NSSet setWithArray:json])
5960
RCT_CUSTOM_CONVERTER(NSData *, NSData, [json dataUsingEncoding:NSUTF8StringEncoding])
6061

61-
+ (NSString *)NSString:(id)json
62-
{
63-
if ([json isKindOfClass:NSString.class]) {
64-
return json;
65-
} else if (json && json != (id)kCFNull) {
66-
return [NSString stringWithFormat:@"%@",json];
67-
}
68-
return nil;
69-
}
70-
7162
+ (NSIndexSet *)NSIndexSet:(id)json
7263
{
7364
json = [self NSNumberArray:json];

0 commit comments

Comments
 (0)