mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix promises on iOS to no longer wrap values in Arrays
Summary: public In https://github.com/facebook/react-native/commit/9baff8f437eee49f8ab0e6f433bf86466ca16662#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:
committed by
Konstantin Raev
parent
dd1e949f12
commit
2c6875effa
@@ -324,11 +324,7 @@ class MessageQueue {
|
||||
method,
|
||||
args,
|
||||
(data) => {
|
||||
// iOS always wraps the data in an Array regardless of what the
|
||||
// shape of the data so we strip it out
|
||||
// Android sends the data back properly
|
||||
// TODO: Remove this once iOS has support for Promises natively (t9774697)
|
||||
resolve(Platform.OS == 'ios' ? data[0] : data);
|
||||
resolve(data);
|
||||
},
|
||||
(errorData) => {
|
||||
var error = createErrorFromErrorData(errorData);
|
||||
|
||||
Reference in New Issue
Block a user