Closed NiuGuohui closed 1 year ago
@Kudo You can test with this code: index.js
(async () => {
function sleep(s) {
return new Promise(r => setTimeout(r, s));
}
console.log(Date.now());
await sleep(5000);
// In fact we waited more than 5 seconds.
console.log(Date.now());
})();
hi there! do you mind to create a github repository of minimal reproducible example for me? because i've tried to disable Promise polyfill and regenerator runtime and it works for me.
I plan to remove the
@babel/plugin-transform-regenerator
to implement a simplified package content. After removing it, RN will use the native v8 Promise, but this Promise will not trigger when communicating with Native.So, can I use the native Promise and other capabilities without metro-polyfill?
This is the
node_modules/metro-react-native-babel-preset/src/configs/main.js
file, which contains my changes: