diff --git a/packages/react-native/Libraries/ActionSheetIOS/ActionSheetIOS.js b/packages/react-native/Libraries/ActionSheetIOS/ActionSheetIOS.js index e758572882c64e..88c0317dfdedb6 100644 --- a/packages/react-native/Libraries/ActionSheetIOS/ActionSheetIOS.js +++ b/packages/react-native/Libraries/ActionSheetIOS/ActionSheetIOS.js @@ -172,4 +172,4 @@ const ActionSheetIOS = { }, }; -module.exports = ActionSheetIOS; +export default ActionSheetIOS; diff --git a/packages/react-native/Libraries/Alert/Alert.js b/packages/react-native/Libraries/Alert/Alert.js index a6b0585f7865e1..a708aff683e762 100644 --- a/packages/react-native/Libraries/Alert/Alert.js +++ b/packages/react-native/Libraries/Alert/Alert.js @@ -174,4 +174,4 @@ class Alert { } } -module.exports = Alert; +export default Alert; diff --git a/packages/react-native/Libraries/Alert/RCTAlertManager.android.js b/packages/react-native/Libraries/Alert/RCTAlertManager.android.js index 3a15b76ac57c55..ea0aee2c6967fd 100644 --- a/packages/react-native/Libraries/Alert/RCTAlertManager.android.js +++ b/packages/react-native/Libraries/Alert/RCTAlertManager.android.js @@ -11,7 +11,7 @@ import NativeDialogManagerAndroid from '../NativeModules/specs/NativeDialogManag function emptyCallback() {} -module.exports = { +export default { alertWithArgs: function (args, callback) { // TODO(5998984): Polyfill it correctly with DialogManagerAndroid if (!NativeDialogManagerAndroid) { diff --git a/packages/react-native/Libraries/Alert/RCTAlertManager.ios.js b/packages/react-native/Libraries/Alert/RCTAlertManager.ios.js index d4e9eab97ff66c..eb40889589bc55 100644 --- a/packages/react-native/Libraries/Alert/RCTAlertManager.ios.js +++ b/packages/react-native/Libraries/Alert/RCTAlertManager.ios.js @@ -12,7 +12,7 @@ import type {Args} from './NativeAlertManager'; import NativeAlertManager from './NativeAlertManager'; -module.exports = { +export default { alertWithArgs( args: Args, callback: (id: number, value: string) => void, diff --git a/packages/react-native/Libraries/Alert/RCTAlertManager.js.flow b/packages/react-native/Libraries/Alert/RCTAlertManager.js.flow index 6f2eddaefcf548..1253aa77a9157b 100644 --- a/packages/react-native/Libraries/Alert/RCTAlertManager.js.flow +++ b/packages/react-native/Libraries/Alert/RCTAlertManager.js.flow @@ -10,7 +10,7 @@ import type {Args} from './NativeAlertManager'; -declare module.exports: { +declare export default { alertWithArgs( args: Args, callback: (id: number, value: string) => void, diff --git a/packages/react-native/Libraries/Core/polyfillPromise.js b/packages/react-native/Libraries/Core/polyfillPromise.js index 857ea8bdb50cba..5bfec271d1c501 100644 --- a/packages/react-native/Libraries/Core/polyfillPromise.js +++ b/packages/react-native/Libraries/Core/polyfillPromise.js @@ -34,5 +34,5 @@ if (global?.HermesInternal?.hasPromise?.()) { ); } } else { - polyfillGlobal('Promise', () => require('../Promise')); + polyfillGlobal('Promise', () => require('../Promise').default); } diff --git a/packages/react-native/Libraries/Core/setUpAlert.js b/packages/react-native/Libraries/Core/setUpAlert.js index 777f7f85fbecbe..7e1a82bb7f25d2 100644 --- a/packages/react-native/Libraries/Core/setUpAlert.js +++ b/packages/react-native/Libraries/Core/setUpAlert.js @@ -18,6 +18,6 @@ if (!global.alert) { global.alert = function (text: string) { // Require Alert on demand. Requiring it too early can lead to issues // with things like Platform not being fully initialized. - require('../Alert/Alert').alert('Alert', '' + text); + require('../Alert/Alert').default.alert('Alert', '' + text); }; } diff --git a/packages/react-native/Libraries/Promise.js b/packages/react-native/Libraries/Promise.js index cb984e71ecc34b..a222b520f0c683 100644 --- a/packages/react-native/Libraries/Promise.js +++ b/packages/react-native/Libraries/Promise.js @@ -20,4 +20,4 @@ if (__DEV__) { ); } -module.exports = Promise; +export default Promise; diff --git a/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap b/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap index 5ff675086e6788..137a5f17afd0be 100644 --- a/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap +++ b/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap @@ -25,7 +25,7 @@ exports[`public API should not change unintentionally Libraries/ActionSheetIOS/A ): void, dismissActionSheet: () => void, }; -declare module.exports: ActionSheetIOS; +declare export default typeof ActionSheetIOS; " `; @@ -72,7 +72,7 @@ declare class Alert { options?: Options ): void; } -declare module.exports: Alert; +declare export default typeof Alert; " `; @@ -83,7 +83,7 @@ declare export default typeof NativeAlertManager; `; exports[`public API should not change unintentionally Libraries/Alert/RCTAlertManager.js.flow 1`] = ` -"declare module.exports: { +"declare export default { alertWithArgs( args: Args, callback: (id: number, value: string) => void @@ -7205,7 +7205,7 @@ exports[`public API should not change unintentionally Libraries/Pressability/use exports[`public API should not change unintentionally Libraries/Promise.js 1`] = ` "declare const Promise: $FlowFixMe; -declare module.exports: Promise; +declare export default typeof Promise; " `; diff --git a/packages/react-native/index.js b/packages/react-native/index.js index 31f568698f6f2a..3f8effd5b6b427 100644 --- a/packages/react-native/index.js +++ b/packages/react-native/index.js @@ -212,10 +212,10 @@ module.exports = { // APIs get ActionSheetIOS(): ActionSheetIOS { - return require('./Libraries/ActionSheetIOS/ActionSheetIOS'); + return require('./Libraries/ActionSheetIOS/ActionSheetIOS').default; }, get Alert(): Alert { - return require('./Libraries/Alert/Alert'); + return require('./Libraries/Alert/Alert').default; }, // Include any types exported in the Animated module together with its default export, so // you can references types such as Animated.Numeric