-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
React Native 0.63 introduces Promise.allSettled but don't work #30236
Comments
From logging on iOS (real device without turning on remote debugging) using react-native v0.63, But from the internals what I see is on android if you use Hermes engine then this Promise Object comes from it, instead of using a polyfill. May be Hermes engine might have a wrong implementation of If you have any other details post here. |
Good point. We dont use Hermes, but maybe we are using in debug mode. I will check, thanks! |
Solved, the problem happened because we used another promises polyfill (Bluebird) that ended up causing the problem. Thank you for your help! |
so, is |
Promise.allSettled is undefined in React Native 0.64.1 for me. Using Hermes for both iOS and Android now. |
RN dont have allSettled by default, you need to use Promise.allSettled polyfill. |
you can implement const allSettled = (promises) => {
return Promise.all(promises.map(promise => promise
.then(value => ({ state: 'fulfilled', value }))
.catch(reason => ({ state: 'rejected', reason }))
));
} |
const allSettled = (promises) => {
return Promise.all(promises.map(promise => promise
.then(value => ({ status: 'fulfilled', value }))
.catch(reason => ({ status: 'rejected', reason }))
));
} |
under the hood react-native uses react-native/Libraries/Promise.js Lines 11 to 16 in 1a9e2d5
So if in that module will implemented UPD: I made PR: then/promise#171 |
React Native 0.63 introduces
Promise.allSettled
but don't work.Description
Until version 0.61 we have used the Promise.allSettled polyfill, but in React Native 63 it stopped working because the Promise.allSettled is a valid function and polyfill is ignored.
However, the native
Promise.allSettled
don't work as expected.React Native version:
Steps To Reproduce
Expected Results
Snack, code example, screenshot, or link to a repository:
I don't think that is necessary.
The text was updated successfully, but these errors were encountered: