diff --git a/packages/react-native/Libraries/Core/polyfillPromise.js b/packages/react-native/Libraries/Core/polyfillPromise.js index 5bfec271d1c5..14124d809dc5 100644 --- a/packages/react-native/Libraries/Core/polyfillPromise.js +++ b/packages/react-native/Libraries/Core/polyfillPromise.js @@ -10,29 +10,22 @@ 'use strict'; -const {polyfillGlobal} = require('../Utilities/PolyfillFunctions'); - /** - * Set up Promise. The native Promise implementation throws the following error: - * ERROR: Event loop not supported. + * Set up Promise. Hermes provides a native Promise implementation that + * satisfies all requirements of React Native. * * If you don't need these polyfills, don't use InitializeCore; just directly * require the modules you need from InitializeCore for setup. */ -// If global.Promise is provided by Hermes, we are confident that it can provide -// all the methods needed by React Native, so we can directly use it. -if (global?.HermesInternal?.hasPromise?.()) { - const HermesPromise = global.Promise; +// Hermes is the only supported JS engine and always provides Promise natively. +const HermesPromise = global.Promise; - if (__DEV__) { - if (typeof HermesPromise !== 'function') { - console.error('HermesPromise does not exist'); - } - global.HermesInternal?.enablePromiseRejectionTracker?.( - require('../promiseRejectionTrackingOptions').default, - ); +if (__DEV__) { + if (typeof HermesPromise !== 'function') { + console.error('HermesPromise does not exist'); } -} else { - polyfillGlobal('Promise', () => require('../Promise').default); + global.HermesInternal?.enablePromiseRejectionTracker?.( + require('../promiseRejectionTrackingOptions').default, + ); }