Fix promises on iOS to no longer wrap values in Arrays
Summary:
public
In 9baff8f437 (diff-8d9841e5b53fd6c9cf3a7f431827e319R331)
, I incorrectly assumed that iOS was wrapping promises in an extra Array. What was really happening is that all the callers were doing this. I removed the wrapping in the callers and the special case handling MessageQueue.
Now one can pass whatever object one wants to resolve and it will show properly in the resolve call on the js side. This fixes issue https://github.com/facebook/react-native/issues/5851
Reviewed By: nicklockwood
Differential Revision: D2921565
fb-gh-sync-id: 9f81e2a87f6a48e9197413b843e452db345a7ff9
shipit-source-id: 9f81e2a87f6a48e9197413b843e452db345a7ff9
This commit is contained in:
parent
e76362614d
commit
9f4522f139
|
@ -98,7 +98,7 @@ RCT_EXPORT_METHOD(saveImageWithTag:(NSString *)imageTag
|
|||
RCTLogWarn(@"Error saving cropped image: %@", saveError);
|
||||
reject(RCTErrorUnableToSave, nil, saveError);
|
||||
} else {
|
||||
resolve(@[assetURL.absoluteString]);
|
||||
resolve(assetURL.absoluteString);
|
||||
}
|
||||
}];
|
||||
});
|
||||
|
@ -110,22 +110,22 @@ static void RCTResolvePromise(RCTPromiseResolveBlock resolve,
|
|||
BOOL hasNextPage)
|
||||
{
|
||||
if (!assets.count) {
|
||||
resolve(@[@{
|
||||
resolve(@{
|
||||
@"edges": assets,
|
||||
@"page_info": @{
|
||||
@"has_next_page": @NO,
|
||||
}
|
||||
}]);
|
||||
});
|
||||
return;
|
||||
}
|
||||
resolve(@[@{
|
||||
resolve(@{
|
||||
@"edges": assets,
|
||||
@"page_info": @{
|
||||
@"start_cursor": assets[0][@"node"][@"image"][@"uri"],
|
||||
@"end_cursor": assets[assets.count - 1][@"node"][@"image"][@"uri"],
|
||||
@"has_next_page": @(hasNextPage),
|
||||
}
|
||||
}]);
|
||||
});
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(getPhotos:(NSDictionary *)params
|
||||
|
|
Loading…
Reference in New Issue