diff --git a/packages/react-native/Libraries/BatchedBridge/MessageQueue.js b/packages/react-native/Libraries/BatchedBridge/MessageQueue.js index 80fa2cbe8a16b7..c9486c81a8c8eb 100644 --- a/packages/react-native/Libraries/BatchedBridge/MessageQueue.js +++ b/packages/react-native/Libraries/BatchedBridge/MessageQueue.js @@ -11,9 +11,10 @@ 'use strict'; const Systrace = require('../Performance/Systrace'); -const deepFreezeAndThrowOnMutationInDev = require('../Utilities/deepFreezeAndThrowOnMutationInDev'); +const deepFreezeAndThrowOnMutationInDev = + require('../Utilities/deepFreezeAndThrowOnMutationInDev').default; const stringifySafe = require('../Utilities/stringifySafe').default; -const warnOnce = require('../Utilities/warnOnce'); +const warnOnce = require('../Utilities/warnOnce').default; const ErrorUtils = require('../vendor/core/ErrorUtils'); const invariant = require('invariant'); diff --git a/packages/react-native/Libraries/BatchedBridge/NativeModules.js b/packages/react-native/Libraries/BatchedBridge/NativeModules.js index a421b0b82a7000..9b6b47e99d9ff3 100644 --- a/packages/react-native/Libraries/BatchedBridge/NativeModules.js +++ b/packages/react-native/Libraries/BatchedBridge/NativeModules.js @@ -186,7 +186,8 @@ if (global.nativeModuleProxy) { '__fbBatchedBridgeConfig is not set, cannot invoke native modules', ); - const defineLazyObjectProperty = require('../Utilities/defineLazyObjectProperty'); + const defineLazyObjectProperty = + require('../Utilities/defineLazyObjectProperty').default; (bridgeConfig.remoteModuleConfig || []).forEach( (config: ModuleConfig, moduleID: number) => { // Initially this config will only contain the module name when running in JSC. The actual diff --git a/packages/react-native/Libraries/Components/Keyboard/__tests__/Keyboard-test.js b/packages/react-native/Libraries/Components/Keyboard/__tests__/Keyboard-test.js index d352aed059d856..9126cacde2eff6 100644 --- a/packages/react-native/Libraries/Components/Keyboard/__tests__/Keyboard-test.js +++ b/packages/react-native/Libraries/Components/Keyboard/__tests__/Keyboard-test.js @@ -10,7 +10,7 @@ */ const LayoutAnimation = require('../../../LayoutAnimation/LayoutAnimation'); -const dismissKeyboard = require('../../../Utilities/dismissKeyboard'); +const dismissKeyboard = require('../../../Utilities/dismissKeyboard').default; const Keyboard = require('../Keyboard'); jest.mock('../../../LayoutAnimation/LayoutAnimation'); diff --git a/packages/react-native/Libraries/Components/LayoutConformance/LayoutConformance.js b/packages/react-native/Libraries/Components/LayoutConformance/LayoutConformance.js index 9b3ebd4915cf95..2781df6c14b374 100644 --- a/packages/react-native/Libraries/Components/LayoutConformance/LayoutConformance.js +++ b/packages/react-native/Libraries/Components/LayoutConformance/LayoutConformance.js @@ -37,7 +37,7 @@ function LayoutConformance(props: Props): React.Node { function UnimplementedLayoutConformance(props: Props): React.Node { if (__DEV__) { - const warnOnce = require('../../Utilities/warnOnce'); + const warnOnce = require('../../Utilities/warnOnce').default; warnOnce( 'layoutconformance-unsupported', diff --git a/packages/react-native/Libraries/Components/RefreshControl/RefreshControl.js b/packages/react-native/Libraries/Components/RefreshControl/RefreshControl.js index 221df2405e256b..6266f4f5b8ebe3 100644 --- a/packages/react-native/Libraries/Components/RefreshControl/RefreshControl.js +++ b/packages/react-native/Libraries/Components/RefreshControl/RefreshControl.js @@ -18,7 +18,7 @@ import PullToRefreshViewNativeComponent, { Commands as PullToRefreshCommands, } from './PullToRefreshViewNativeComponent'; -const Platform = require('../../Utilities/Platform'); +const Platform = require('../../Utilities/Platform').default; const React = require('react'); type IOSProps = $ReadOnly<{| diff --git a/packages/react-native/Libraries/Components/ScrollView/ScrollViewNativeComponent.js b/packages/react-native/Libraries/Components/ScrollView/ScrollViewNativeComponent.js index 9e225c1dc21bbc..2709ce0d81559a 100644 --- a/packages/react-native/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +++ b/packages/react-native/Libraries/Components/ScrollView/ScrollViewNativeComponent.js @@ -42,7 +42,7 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = }, validAttributes: { contentOffset: { - diff: require('../../Utilities/differ/pointsDiffer'), + diff: require('../../Utilities/differ/pointsDiffer').default, }, decelerationRate: true, disableIntervalMomentum: true, @@ -126,10 +126,10 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = canCancelContentTouches: true, centerContent: true, contentInset: { - diff: require('../../Utilities/differ/insetsDiffer'), + diff: require('../../Utilities/differ/insetsDiffer').default, }, contentOffset: { - diff: require('../../Utilities/differ/pointsDiffer'), + diff: require('../../Utilities/differ/pointsDiffer').default, }, contentInsetAdjustmentBehavior: true, decelerationRate: true, @@ -147,7 +147,7 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = scrollEnabled: true, scrollEventThrottle: true, scrollIndicatorInsets: { - diff: require('../../Utilities/differ/insetsDiffer'), + diff: require('../../Utilities/differ/insetsDiffer').default, }, scrollToOverflowEnabled: true, scrollsToTop: true, @@ -159,7 +159,7 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = snapToOffsets: true, snapToStart: true, verticalScrollIndicatorInsets: { - diff: require('../../Utilities/differ/insetsDiffer'), + diff: require('../../Utilities/differ/insetsDiffer').default, }, zoomScale: true, ...ConditionallyIgnoredEventHandlers({ diff --git a/packages/react-native/Libraries/Components/TextInput/RCTTextInputViewConfig.js b/packages/react-native/Libraries/Components/TextInput/RCTTextInputViewConfig.js index 2e528a415b49d2..08a018a61fb20a 100644 --- a/packages/react-native/Libraries/Components/TextInput/RCTTextInputViewConfig.js +++ b/packages/react-native/Libraries/Components/TextInput/RCTTextInputViewConfig.js @@ -98,7 +98,9 @@ const RCTTextInputViewConfig = { fontWeight: true, fontVariant: true, // flowlint-next-line untyped-import:off - textShadowOffset: {diff: require('../../Utilities/differ/sizesDiffer')}, + textShadowOffset: { + diff: require('../../Utilities/differ/sizesDiffer').default, + }, allowFontScaling: true, fontStyle: true, textTransform: true, diff --git a/packages/react-native/Libraries/Components/TextInput/TextInputState.js b/packages/react-native/Libraries/Components/TextInput/TextInputState.js index b3dfd5c8ca061b..7cc8b6293a2750 100644 --- a/packages/react-native/Libraries/Components/TextInput/TextInputState.js +++ b/packages/react-native/Libraries/Components/TextInput/TextInputState.js @@ -23,7 +23,7 @@ import {Commands as AndroidTextInputCommands} from '../../Components/TextInput/A import {Commands as iOSTextInputCommands} from '../../Components/TextInput/RCTSingelineTextInputNativeComponent'; const {findNodeHandle} = require('../../ReactNative/RendererProxy'); -const Platform = require('../../Utilities/Platform'); +const Platform = require('../../Utilities/Platform').default; let currentlyFocusedInputRef: ?HostInstance = null; const inputs = new Set<{ diff --git a/packages/react-native/Libraries/Core/InitializeCore.js b/packages/react-native/Libraries/Core/InitializeCore.js index f01d96e0df1194..d705a16faf1f9b 100644 --- a/packages/react-native/Libraries/Core/InitializeCore.js +++ b/packages/react-native/Libraries/Core/InitializeCore.js @@ -48,7 +48,8 @@ if (__DEV__) { require('../ReactNative/AppRegistry'); -const GlobalPerformanceLogger = require('../Utilities/GlobalPerformanceLogger'); +const GlobalPerformanceLogger = + require('../Utilities/GlobalPerformanceLogger').default; // We could just call GlobalPerformanceLogger.markPoint at the top of the file, // but then we'd be excluding the time it took to require the logger. // Instead, we just use Date.now and backdate the timestamp. diff --git a/packages/react-native/Libraries/Core/setUpBatchedBridge.js b/packages/react-native/Libraries/Core/setUpBatchedBridge.js index d2768a32eeac60..8f3faf348b34bf 100644 --- a/packages/react-native/Libraries/Core/setUpBatchedBridge.js +++ b/packages/react-native/Libraries/Core/setUpBatchedBridge.js @@ -16,7 +16,7 @@ registerModule('Systrace', () => require('../Performance/Systrace')); if (!(global.RN$Bridgeless === true)) { registerModule('JSTimers', () => require('./Timers/JSTimers')); } -registerModule('RCTLog', () => require('../Utilities/RCTLog')); +registerModule('RCTLog', () => require('../Utilities/RCTLog').default); registerModule( 'RCTDeviceEventEmitter', () => require('../EventEmitter/RCTDeviceEventEmitter').default, @@ -24,12 +24,16 @@ registerModule( registerModule('RCTNativeAppEventEmitter', () => require('../EventEmitter/RCTNativeAppEventEmitter'), ); -registerModule('GlobalPerformanceLogger', () => - require('../Utilities/GlobalPerformanceLogger'), +registerModule( + 'GlobalPerformanceLogger', + () => require('../Utilities/GlobalPerformanceLogger').default, ); if (__DEV__) { - registerModule('HMRClient', () => require('../Utilities/HMRClient')); + registerModule('HMRClient', () => require('../Utilities/HMRClient').default); } else { - registerModule('HMRClient', () => require('../Utilities/HMRClientProdShim')); + registerModule( + 'HMRClient', + () => require('../Utilities/HMRClientProdShim').default, + ); } diff --git a/packages/react-native/Libraries/Core/setUpDeveloperTools.js b/packages/react-native/Libraries/Core/setUpDeveloperTools.js index 5cc39eae9c1274..8330c04e8ffa02 100644 --- a/packages/react-native/Libraries/Core/setUpDeveloperTools.js +++ b/packages/react-native/Libraries/Core/setUpDeveloperTools.js @@ -40,7 +40,7 @@ if (__DEV__) { global.navigator.appName === 'Netscape'; // Any real browser if (!Platform.isTesting) { - const HMRClient = require('../Utilities/HMRClient'); + const HMRClient = require('../Utilities/HMRClient').default; if (global.__FUSEBOX_HAS_FULL_CONSOLE_SUPPORT__) { HMRClient.unstable_notifyFuseboxConsoleEnabled(); diff --git a/packages/react-native/Libraries/Core/setUpReactRefresh.js b/packages/react-native/Libraries/Core/setUpReactRefresh.js index 164aa294379b5d..be8844dcf34425 100644 --- a/packages/react-native/Libraries/Core/setUpReactRefresh.js +++ b/packages/react-native/Libraries/Core/setUpReactRefresh.js @@ -11,7 +11,7 @@ 'use strict'; if (__DEV__) { - const DevSettings = require('../Utilities/DevSettings'); + const DevSettings = require('../Utilities/DevSettings').default; if (typeof DevSettings.reload !== 'function') { throw new Error('Could not find the reload() implementation.'); diff --git a/packages/react-native/Libraries/Image/AssetSourceResolver.js b/packages/react-native/Libraries/Image/AssetSourceResolver.js index 93f71702acd468..de03d07d4c4e15 100644 --- a/packages/react-native/Libraries/Image/AssetSourceResolver.js +++ b/packages/react-native/Libraries/Image/AssetSourceResolver.js @@ -24,7 +24,7 @@ import type { } from '@react-native/assets-registry/registry'; const PixelRatio = require('../Utilities/PixelRatio').default; -const Platform = require('../Utilities/Platform'); +const Platform = require('../Utilities/Platform').default; const {pickScale} = require('./AssetUtils'); const { getAndroidResourceFolderName, diff --git a/packages/react-native/Libraries/Image/ImageViewNativeComponent.js b/packages/react-native/Libraries/Image/ImageViewNativeComponent.js index 22ac430c2190ef..2926f0d92de413 100644 --- a/packages/react-native/Libraries/Image/ImageViewNativeComponent.js +++ b/packages/react-native/Libraries/Image/ImageViewNativeComponent.js @@ -143,7 +143,7 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = validAttributes: { blurRadius: true, capInsets: { - diff: require('../Utilities/differ/insetsDiffer'), + diff: require('../Utilities/differ/insetsDiffer').default, }, defaultSource: { process: require('./resolveAssetSource'), diff --git a/packages/react-native/Libraries/Image/__tests__/resolveAssetSource-test.js b/packages/react-native/Libraries/Image/__tests__/resolveAssetSource-test.js index e924b3dc61c38f..4ee9189c51208c 100644 --- a/packages/react-native/Libraries/Image/__tests__/resolveAssetSource-test.js +++ b/packages/react-native/Libraries/Image/__tests__/resolveAssetSource-test.js @@ -23,7 +23,7 @@ describe('resolveAssetSource', () => { resolveAssetSource = require('../resolveAssetSource'); NativeSourceCode = require('../../NativeModules/specs/NativeSourceCode').default; - Platform = require('../../Utilities/Platform'); + Platform = require('../../Utilities/Platform').default; }); it('returns same source for simple static and network images', () => { diff --git a/packages/react-native/Libraries/Inspector/ElementProperties.js b/packages/react-native/Libraries/Inspector/ElementProperties.js index ba01f10d9f0002..fa4c81d26842c6 100644 --- a/packages/react-native/Libraries/Inspector/ElementProperties.js +++ b/packages/react-native/Libraries/Inspector/ElementProperties.js @@ -21,7 +21,7 @@ const View = require('../Components/View/View'); const flattenStyle = require('../StyleSheet/flattenStyle'); const StyleSheet = require('../StyleSheet/StyleSheet'); const Text = require('../Text/Text'); -const mapWithSeparator = require('../Utilities/mapWithSeparator'); +const mapWithSeparator = require('../Utilities/mapWithSeparator').default; const BoxInspector = require('./BoxInspector'); const StyleInspector = require('./StyleInspector'); diff --git a/packages/react-native/Libraries/Inspector/Inspector.js b/packages/react-native/Libraries/Inspector/Inspector.js index 85a239b01b4630..47ef148a0ad398 100644 --- a/packages/react-native/Libraries/Inspector/Inspector.js +++ b/packages/react-native/Libraries/Inspector/Inspector.js @@ -26,7 +26,7 @@ const PressabilityDebug = require('../Pressability/PressabilityDebug'); const {findNodeHandle} = require('../ReactNative/RendererProxy'); const StyleSheet = require('../StyleSheet/StyleSheet'); const Dimensions = require('../Utilities/Dimensions').default; -const Platform = require('../Utilities/Platform'); +const Platform = require('../Utilities/Platform').default; const getInspectorDataForViewAtPoint = require('./getInspectorDataForViewAtPoint'); const InspectorOverlay = require('./InspectorOverlay'); const InspectorPanel = require('./InspectorPanel'); diff --git a/packages/react-native/Libraries/Inspector/PerformanceOverlay.js b/packages/react-native/Libraries/Inspector/PerformanceOverlay.js index ec30fbbb8bdbf6..99ec1ee9faad2d 100644 --- a/packages/react-native/Libraries/Inspector/PerformanceOverlay.js +++ b/packages/react-native/Libraries/Inspector/PerformanceOverlay.js @@ -15,7 +15,8 @@ import React from 'react'; const View = require('../Components/View/View'); const StyleSheet = require('../StyleSheet/StyleSheet'); const Text = require('../Text/Text'); -const PerformanceLogger = require('../Utilities/GlobalPerformanceLogger'); +const PerformanceLogger = + require('../Utilities/GlobalPerformanceLogger').default; class PerformanceOverlay extends React.Component<{...}> { render(): React.Node { diff --git a/packages/react-native/Libraries/Interaction/InteractionManager.js b/packages/react-native/Libraries/Interaction/InteractionManager.js index 3257921ec97f99..0d98b15f40f264 100644 --- a/packages/react-native/Libraries/Interaction/InteractionManager.js +++ b/packages/react-native/Libraries/Interaction/InteractionManager.js @@ -14,7 +14,7 @@ import * as ReactNativeFeatureFlags from '../../src/private/featureflags/ReactNa import EventEmitter from '../vendor/emitter/EventEmitter'; const BatchedBridge = require('../BatchedBridge/BatchedBridge'); -const infoLog = require('../Utilities/infoLog'); +const infoLog = require('../Utilities/infoLog').default; const TaskQueue = require('./TaskQueue'); const invariant = require('invariant'); diff --git a/packages/react-native/Libraries/Interaction/JSEventLoopWatchdog.js b/packages/react-native/Libraries/Interaction/JSEventLoopWatchdog.js index 1db16e53ed7abe..67280653619e0b 100644 --- a/packages/react-native/Libraries/Interaction/JSEventLoopWatchdog.js +++ b/packages/react-native/Libraries/Interaction/JSEventLoopWatchdog.js @@ -10,7 +10,7 @@ 'use strict'; -const infoLog = require('../Utilities/infoLog'); +const infoLog = require('../Utilities/infoLog').default; type Handler = { onIterate?: () => void, diff --git a/packages/react-native/Libraries/Interaction/TaskQueue.js b/packages/react-native/Libraries/Interaction/TaskQueue.js index 958f8415dac574..c7e217166ca293 100644 --- a/packages/react-native/Libraries/Interaction/TaskQueue.js +++ b/packages/react-native/Libraries/Interaction/TaskQueue.js @@ -10,7 +10,7 @@ 'use strict'; -const infoLog = require('../Utilities/infoLog'); +const infoLog = require('../Utilities/infoLog').default; const invariant = require('invariant'); type SimpleTask = { diff --git a/packages/react-native/Libraries/Lists/FlatList.js b/packages/react-native/Libraries/Lists/FlatList.js index 4aec7559f7f6a9..cb05d3549d835a 100644 --- a/packages/react-native/Libraries/Lists/FlatList.js +++ b/packages/react-native/Libraries/Lists/FlatList.js @@ -27,8 +27,8 @@ import memoizeOne from 'memoize-one'; const View = require('../Components/View/View'); const StyleSheet = require('../StyleSheet/StyleSheet'); -const deepDiffer = require('../Utilities/differ/deepDiffer'); -const Platform = require('../Utilities/Platform'); +const deepDiffer = require('../Utilities/differ/deepDiffer').default; +const Platform = require('../Utilities/Platform').default; const invariant = require('invariant'); const React = require('react'); diff --git a/packages/react-native/Libraries/Modal/Modal.js b/packages/react-native/Libraries/Modal/Modal.js index 8d0a85b15fb9ac..16ab91bbea8ce9 100644 --- a/packages/react-native/Libraries/Modal/Modal.js +++ b/packages/react-native/Libraries/Modal/Modal.js @@ -26,7 +26,7 @@ const AppContainer = require('../ReactNative/AppContainer'); const I18nManager = require('../ReactNative/I18nManager'); const {RootTagContext} = require('../ReactNative/RootTag'); const StyleSheet = require('../StyleSheet/StyleSheet'); -const Platform = require('../Utilities/Platform'); +const Platform = require('../Utilities/Platform').default; type ModalEventDefinitions = { modalDismissed: [{modalID: number}], diff --git a/packages/react-native/Libraries/NativeComponent/BaseViewConfig.ios.js b/packages/react-native/Libraries/NativeComponent/BaseViewConfig.ios.js index 2cd155760db666..d3288e2a031ac8 100644 --- a/packages/react-native/Libraries/NativeComponent/BaseViewConfig.ios.js +++ b/packages/react-native/Libraries/NativeComponent/BaseViewConfig.ios.js @@ -201,13 +201,13 @@ const validAttributesForNonEventProps = { cursor: true, opacity: true, shadowColor: {process: require('../StyleSheet/processColor').default}, - shadowOffset: {diff: require('../Utilities/differ/sizesDiffer')}, + shadowOffset: {diff: require('../Utilities/differ/sizesDiffer').default}, shadowOpacity: true, shadowRadius: true, needsOffscreenAlphaCompositing: true, overflow: true, shouldRasterizeIOS: true, - transform: {diff: require('../Utilities/differ/matricesDiffer')}, + transform: {diff: require('../Utilities/differ/matricesDiffer').default}, transformOrigin: true, accessibilityRole: true, accessibilityState: true, @@ -222,7 +222,7 @@ const validAttributesForNonEventProps = { borderWidth: true, borderBlockWidth: true, borderStyle: true, - hitSlop: {diff: require('../Utilities/differ/insetsDiffer')}, + hitSlop: {diff: require('../Utilities/differ/insetsDiffer').default}, collapsable: true, collapsableChildren: true, filter: { diff --git a/packages/react-native/Libraries/Network/XMLHttpRequest.js b/packages/react-native/Libraries/Network/XMLHttpRequest.js index 7697233ae0aa82..c807439b8a0514 100644 --- a/packages/react-native/Libraries/Network/XMLHttpRequest.js +++ b/packages/react-native/Libraries/Network/XMLHttpRequest.js @@ -16,7 +16,8 @@ import {type EventSubscription} from '../vendor/emitter/EventEmitter'; import EventTarget from 'event-target-shim'; const BlobManager = require('../Blob/BlobManager'); -const GlobalPerformanceLogger = require('../Utilities/GlobalPerformanceLogger'); +const GlobalPerformanceLogger = + require('../Utilities/GlobalPerformanceLogger').default; const RCTNetworking = require('./RCTNetworking').default; const base64 = require('base64-js'); const invariant = require('invariant'); diff --git a/packages/react-native/Libraries/Network/__tests__/XMLHttpRequest-test.js b/packages/react-native/Libraries/Network/__tests__/XMLHttpRequest-test.js index 79ad6cfa791160..8039bd488f04f7 100644 --- a/packages/react-native/Libraries/Network/__tests__/XMLHttpRequest-test.js +++ b/packages/react-native/Libraries/Network/__tests__/XMLHttpRequest-test.js @@ -12,8 +12,9 @@ const createPerformanceLogger = require('../../Utilities/createPerformanceLogger').default; -const GlobalPerformanceLogger = require('../../Utilities/GlobalPerformanceLogger'); -const Platform = require('../../Utilities/Platform'); +const GlobalPerformanceLogger = + require('../../Utilities/GlobalPerformanceLogger').default; +const Platform = require('../../Utilities/Platform').default; const XMLHttpRequest = require('../XMLHttpRequest'); jest.unmock('../../Utilities/Platform'); diff --git a/packages/react-native/Libraries/Network/convertRequestBody.js b/packages/react-native/Libraries/Network/convertRequestBody.js index b9bd960976331f..b25cfd26f3c843 100644 --- a/packages/react-native/Libraries/Network/convertRequestBody.js +++ b/packages/react-native/Libraries/Network/convertRequestBody.js @@ -11,7 +11,7 @@ 'use strict'; const Blob = require('../Blob/Blob'); -const binaryToBase64 = require('../Utilities/binaryToBase64'); +const binaryToBase64 = require('../Utilities/binaryToBase64').default; const FormData = require('./FormData'); export type RequestBody = diff --git a/packages/react-native/Libraries/PermissionsAndroid/PermissionsAndroid.js b/packages/react-native/Libraries/PermissionsAndroid/PermissionsAndroid.js index 3a1964886a5e15..e9bbb02b93ae20 100644 --- a/packages/react-native/Libraries/PermissionsAndroid/PermissionsAndroid.js +++ b/packages/react-native/Libraries/PermissionsAndroid/PermissionsAndroid.js @@ -17,7 +17,7 @@ import NativeDialogManagerAndroid from '../NativeModules/specs/NativeDialogManag import NativePermissionsAndroid from './NativePermissionsAndroid'; import invariant from 'invariant'; -const Platform = require('../Utilities/Platform'); +const Platform = require('../Utilities/Platform').default; export type Rationale = { title: string, diff --git a/packages/react-native/Libraries/Pressability/__tests__/Pressability-test.js b/packages/react-native/Libraries/Pressability/__tests__/Pressability-test.js index a70cd006fc998f..3b10d7e0937a33 100644 --- a/packages/react-native/Libraries/Pressability/__tests__/Pressability-test.js +++ b/packages/react-native/Libraries/Pressability/__tests__/Pressability-test.js @@ -16,7 +16,7 @@ import type {PressEvent} from '../../Types/CoreEventTypes'; import type {PressabilityConfig} from '../Pressability'; const UIManager = require('../../ReactNative/UIManager'); -const Platform = require('../../Utilities/Platform'); +const Platform = require('../../Utilities/Platform').default; const HoverState = require('../HoverState'); const Pressability = require('../Pressability').default; const invariant = require('invariant'); diff --git a/packages/react-native/Libraries/ReactNative/PaperUIManager.js b/packages/react-native/Libraries/ReactNative/PaperUIManager.js index abdf455fabd8e3..fe6b7fd293c029 100644 --- a/packages/react-native/Libraries/ReactNative/PaperUIManager.js +++ b/packages/react-native/Libraries/ReactNative/PaperUIManager.js @@ -15,8 +15,9 @@ import NativeUIManager from './NativeUIManager'; import nullthrows from 'nullthrows'; const NativeModules = require('../BatchedBridge/NativeModules'); -const defineLazyObjectProperty = require('../Utilities/defineLazyObjectProperty'); -const Platform = require('../Utilities/Platform'); +const defineLazyObjectProperty = + require('../Utilities/defineLazyObjectProperty').default; +const Platform = require('../Utilities/Platform').default; const UIManagerProperties = require('./UIManagerProperties'); const viewManagerConfigs: {[string]: any | null} = {}; diff --git a/packages/react-native/Libraries/ReactNative/getNativeComponentAttributes.js b/packages/react-native/Libraries/ReactNative/getNativeComponentAttributes.js index aae2d4d6796700..57c2c0f98fc230 100644 --- a/packages/react-native/Libraries/ReactNative/getNativeComponentAttributes.js +++ b/packages/react-native/Libraries/ReactNative/getNativeComponentAttributes.js @@ -19,10 +19,10 @@ const processBackgroundImage = const processColor = require('../StyleSheet/processColor').default; const processColorArray = require('../StyleSheet/processColorArray').default; const processFilter = require('../StyleSheet/processFilter').default; -const insetsDiffer = require('../Utilities/differ/insetsDiffer'); -const matricesDiffer = require('../Utilities/differ/matricesDiffer'); -const pointsDiffer = require('../Utilities/differ/pointsDiffer'); -const sizesDiffer = require('../Utilities/differ/sizesDiffer'); +const insetsDiffer = require('../Utilities/differ/insetsDiffer').default; +const matricesDiffer = require('../Utilities/differ/matricesDiffer').default; +const pointsDiffer = require('../Utilities/differ/pointsDiffer').default; +const sizesDiffer = require('../Utilities/differ/sizesDiffer').default; const UIManager = require('./UIManager'); const nullthrows = require('nullthrows'); diff --git a/packages/react-native/Libraries/ReactPrivate/ReactNativePrivateInterface.js b/packages/react-native/Libraries/ReactPrivate/ReactNativePrivateInterface.js index 206b826f14ed0d..e142c0783c0ff9 100644 --- a/packages/react-native/Libraries/ReactPrivate/ReactNativePrivateInterface.js +++ b/packages/react-native/Libraries/ReactPrivate/ReactNativePrivateInterface.js @@ -44,7 +44,7 @@ module.exports = { return require('../Core/ExceptionsManager'); }, get Platform(): Platform { - return require('../Utilities/Platform'); + return require('../Utilities/Platform').default; }, get RCTEventEmitter(): RCTEventEmitter { return require('../EventEmitter/RCTEventEmitter'); @@ -60,12 +60,12 @@ module.exports = { }, // TODO: Remove when React has migrated to `createAttributePayload` and `diffAttributePayloads` get deepDiffer(): deepDiffer { - return require('../Utilities/differ/deepDiffer'); + return require('../Utilities/differ/deepDiffer').default; }, get deepFreezeAndThrowOnMutationInDev(): deepFreezeAndThrowOnMutationInDev< {...} | Array, > { - return require('../Utilities/deepFreezeAndThrowOnMutationInDev'); + return require('../Utilities/deepFreezeAndThrowOnMutationInDev').default; }, // TODO: Remove when React has migrated to `createAttributePayload` and `diffAttributePayloads` get flattenStyle(): flattenStyle { diff --git a/packages/react-native/Libraries/Share/Share.js b/packages/react-native/Libraries/Share/Share.js index 0a21bbac142bf6..e6496c93a2528a 100644 --- a/packages/react-native/Libraries/Share/Share.js +++ b/packages/react-native/Libraries/Share/Share.js @@ -12,7 +12,7 @@ import NativeActionSheetManager from '../ActionSheetIOS/NativeActionSheetManager import NativeShareModule from './NativeShareModule'; const processColor = require('../StyleSheet/processColor').default; -const Platform = require('../Utilities/Platform'); +const Platform = require('../Utilities/Platform').default; const invariant = require('invariant'); export type ShareContent = diff --git a/packages/react-native/Libraries/StyleSheet/__tests__/normalizeColor-test.js b/packages/react-native/Libraries/StyleSheet/__tests__/normalizeColor-test.js index 81cd20ad12d13f..e141f58ee85659 100644 --- a/packages/react-native/Libraries/StyleSheet/__tests__/normalizeColor-test.js +++ b/packages/react-native/Libraries/StyleSheet/__tests__/normalizeColor-test.js @@ -10,7 +10,7 @@ 'use strict'; -const {OS} = require('../../Utilities/Platform'); +const {OS} = require('../../Utilities/Platform').default; const normalizeColor = require('../normalizeColor').default; it('forwards calls to @react-native/normalize-colors', () => { diff --git a/packages/react-native/Libraries/StyleSheet/__tests__/processBackgroundImage-test.js b/packages/react-native/Libraries/StyleSheet/__tests__/processBackgroundImage-test.js index 624f79df47885d..24fac37ac29bc1 100644 --- a/packages/react-native/Libraries/StyleSheet/__tests__/processBackgroundImage-test.js +++ b/packages/react-native/Libraries/StyleSheet/__tests__/processBackgroundImage-test.js @@ -12,7 +12,7 @@ import processBackgroundImage from '../processBackgroundImage'; -const {OS} = require('../../Utilities/Platform'); +const {OS} = require('../../Utilities/Platform').default; const PlatformColorAndroid = require('../PlatformColorValueTypes.android').PlatformColor; const PlatformColorIOS = diff --git a/packages/react-native/Libraries/StyleSheet/__tests__/processColor-test.js b/packages/react-native/Libraries/StyleSheet/__tests__/processColor-test.js index 8761fc0d156505..d72ff85491d091 100644 --- a/packages/react-native/Libraries/StyleSheet/__tests__/processColor-test.js +++ b/packages/react-native/Libraries/StyleSheet/__tests__/processColor-test.js @@ -10,7 +10,7 @@ 'use strict'; -const {OS} = require('../../Utilities/Platform'); +const {OS} = require('../../Utilities/Platform').default; const PlatformColorAndroid = require('../PlatformColorValueTypes.android').PlatformColor; const PlatformColorIOS = diff --git a/packages/react-native/Libraries/StyleSheet/__tests__/processColorArray-test.js b/packages/react-native/Libraries/StyleSheet/__tests__/processColorArray-test.js index 4f4b5685119d2b..a460730428e7f0 100644 --- a/packages/react-native/Libraries/StyleSheet/__tests__/processColorArray-test.js +++ b/packages/react-native/Libraries/StyleSheet/__tests__/processColorArray-test.js @@ -10,7 +10,7 @@ 'use strict'; -const {OS} = require('../../Utilities/Platform'); +const {OS} = require('../../Utilities/Platform').default; const PlatformColorAndroid = require('../PlatformColorValueTypes.android').PlatformColor; const PlatformColorIOS = diff --git a/packages/react-native/Libraries/StyleSheet/processColor.js b/packages/react-native/Libraries/StyleSheet/processColor.js index d8d0e996d287da..ca6a5a314a8deb 100644 --- a/packages/react-native/Libraries/StyleSheet/processColor.js +++ b/packages/react-native/Libraries/StyleSheet/processColor.js @@ -12,7 +12,7 @@ import type {ColorValue, NativeColorValue} from './StyleSheet'; -const Platform = require('../Utilities/Platform'); +const Platform = require('../Utilities/Platform').default; const normalizeColor = require('./normalizeColor').default; export type ProcessedColorValue = number | NativeColorValue; diff --git a/packages/react-native/Libraries/UTFSequence.js b/packages/react-native/Libraries/UTFSequence.js index 05a8562960d30b..34cb5017fb7921 100644 --- a/packages/react-native/Libraries/UTFSequence.js +++ b/packages/react-native/Libraries/UTFSequence.js @@ -10,7 +10,8 @@ 'use strict'; -const deepFreezeAndThrowOnMutationInDev = require('./Utilities/deepFreezeAndThrowOnMutationInDev'); +const deepFreezeAndThrowOnMutationInDev = + require('./Utilities/deepFreezeAndThrowOnMutationInDev').default; /** * A collection of Unicode sequences for various characters and emoji. diff --git a/packages/react-native/Libraries/Utilities/BackHandler.android.js b/packages/react-native/Libraries/Utilities/BackHandler.android.js index 14fb436c8c4c4b..dcad3eb7ceef1f 100644 --- a/packages/react-native/Libraries/Utilities/BackHandler.android.js +++ b/packages/react-native/Libraries/Utilities/BackHandler.android.js @@ -93,4 +93,4 @@ const BackHandler: TBackHandler = { }, }; -module.exports = BackHandler; +export default BackHandler; diff --git a/packages/react-native/Libraries/Utilities/BackHandler.ios.js b/packages/react-native/Libraries/Utilities/BackHandler.ios.js index bc4cf85c634cb0..2452f4e7779754 100644 --- a/packages/react-native/Libraries/Utilities/BackHandler.ios.js +++ b/packages/react-native/Libraries/Utilities/BackHandler.ios.js @@ -21,7 +21,7 @@ type TBackHandler = {| ) => {remove: () => void, ...}, |}; -let BackHandler: TBackHandler = { +const BackHandler: TBackHandler = { exitApp: emptyFunction, addEventListener(_eventName: BackPressEventName, _handler: BackPressHandler) { return { @@ -30,4 +30,4 @@ let BackHandler: TBackHandler = { }, }; -module.exports = BackHandler; +export default BackHandler; diff --git a/packages/react-native/Libraries/Utilities/BackHandler.js.flow b/packages/react-native/Libraries/Utilities/BackHandler.js.flow index aec78e1697004b..37c907156cb4bf 100644 --- a/packages/react-native/Libraries/Utilities/BackHandler.js.flow +++ b/packages/react-native/Libraries/Utilities/BackHandler.js.flow @@ -20,4 +20,4 @@ type TBackHandler = {| ) => {remove: () => void, ...}, |}; -declare module.exports: TBackHandler; +declare export default TBackHandler; diff --git a/packages/react-native/Libraries/Utilities/DevLoadingView.js b/packages/react-native/Libraries/Utilities/DevLoadingView.js index 45119f94fcc889..54ce1d8818539e 100644 --- a/packages/react-native/Libraries/Utilities/DevLoadingView.js +++ b/packages/react-native/Libraries/Utilities/DevLoadingView.js @@ -35,7 +35,7 @@ const COLOR_SCHEME = { }, }; -module.exports = { +export default { showMessage(message: string, type: 'load' | 'refresh') { if (NativeDevLoadingView) { const colorScheme = diff --git a/packages/react-native/Libraries/Utilities/DevSettings.js b/packages/react-native/Libraries/Utilities/DevSettings.js index af227f2582d539..8e9991ee1b5717 100644 --- a/packages/react-native/Libraries/Utilities/DevSettings.js +++ b/packages/react-native/Libraries/Utilities/DevSettings.js @@ -69,4 +69,4 @@ if (__DEV__) { }; } -module.exports = DevSettings; +export default DevSettings; diff --git a/packages/react-native/Libraries/Utilities/DeviceInfo.js b/packages/react-native/Libraries/Utilities/DeviceInfo.js index 600bbc3266e42d..a72eec954f01e2 100644 --- a/packages/react-native/Libraries/Utilities/DeviceInfo.js +++ b/packages/react-native/Libraries/Utilities/DeviceInfo.js @@ -10,4 +10,4 @@ import NativeDeviceInfo from './NativeDeviceInfo'; -module.exports = NativeDeviceInfo; +export default NativeDeviceInfo; diff --git a/packages/react-native/Libraries/Utilities/FeatureDetection.js b/packages/react-native/Libraries/Utilities/FeatureDetection.js index a83058d6936dc1..83cdd80ac4e114 100644 --- a/packages/react-native/Libraries/Utilities/FeatureDetection.js +++ b/packages/react-native/Libraries/Utilities/FeatureDetection.js @@ -15,7 +15,7 @@ * Note that a polyfill can technically fake this behavior but few does it. * Therefore, this is usually good enough for our purpose. */ -function isNativeFunction(f: Function): boolean { +export function isNativeFunction(f: Function): boolean { return typeof f === 'function' && f.toString().indexOf('[native code]') > -1; } @@ -23,9 +23,7 @@ function isNativeFunction(f: Function): boolean { * @return whether or not the constructor of @param {object} o is an native * function named with @param {string} expectedName. */ -function hasNativeConstructor(o: Object, expectedName: string): boolean { +export function hasNativeConstructor(o: Object, expectedName: string): boolean { const con = Object.getPrototypeOf(o).constructor; return con.name === expectedName && isNativeFunction(con); } - -module.exports = {isNativeFunction, hasNativeConstructor}; diff --git a/packages/react-native/Libraries/Utilities/GlobalPerformanceLogger.js b/packages/react-native/Libraries/Utilities/GlobalPerformanceLogger.js index d119f6316c1227..de3ea27ae2bec1 100644 --- a/packages/react-native/Libraries/Utilities/GlobalPerformanceLogger.js +++ b/packages/react-native/Libraries/Utilities/GlobalPerformanceLogger.js @@ -21,4 +21,4 @@ import createPerformanceLogger from './createPerformanceLogger'; */ const GlobalPerformanceLogger: IPerformanceLogger = createPerformanceLogger(); -module.exports = GlobalPerformanceLogger; +export default GlobalPerformanceLogger; diff --git a/packages/react-native/Libraries/Utilities/HMRClient.js b/packages/react-native/Libraries/Utilities/HMRClient.js index c7832f7bb469e0..9c9c0f558bd9fe 100644 --- a/packages/react-native/Libraries/Utilities/HMRClient.js +++ b/packages/react-native/Libraries/Utilities/HMRClient.js @@ -14,8 +14,8 @@ import getDevServer from '../Core/Devtools/getDevServer'; import LogBox from '../LogBox/LogBox'; import NativeRedBox from '../NativeModules/specs/NativeRedBox'; -const DevSettings = require('./DevSettings'); -const Platform = require('./Platform'); +const DevSettings = require('./DevSettings').default; +const Platform = require('./Platform').default; const invariant = require('invariant'); const MetroHMRClient = require('metro-runtime/src/modules/HMRClient'); const prettyFormat = require('pretty-format'); @@ -70,7 +70,7 @@ const HMRClient: HMRClientNativeInterface = { } invariant(hmrClient, 'Expected HMRClient.setup() call at startup.'); - const DevLoadingView = require('./DevLoadingView'); + const DevLoadingView = require('./DevLoadingView').default; // We use this for internal logging only. // It doesn't affect the logic. @@ -181,7 +181,7 @@ const HMRClient: HMRClientNativeInterface = { invariant(!hmrClient, 'Cannot initialize hmrClient twice'); // Moving to top gives errors due to NativeModules not being initialized - const DevLoadingView = require('./DevLoadingView'); + const DevLoadingView = require('./DevLoadingView').default; const serverHost = port !== null && port !== '' ? `${host}:${port}` : host; @@ -387,4 +387,4 @@ function showCompileError() { throw error; } -module.exports = HMRClient; +export default HMRClient; diff --git a/packages/react-native/Libraries/Utilities/HMRClientProdShim.js b/packages/react-native/Libraries/Utilities/HMRClientProdShim.js index c4492b845454c1..0aa864964effbd 100644 --- a/packages/react-native/Libraries/Utilities/HMRClientProdShim.js +++ b/packages/react-native/Libraries/Utilities/HMRClientProdShim.js @@ -28,4 +28,4 @@ const HMRClientProdShim: HMRClientNativeInterface = { unstable_notifyFuseboxConsoleEnabled() {}, }; -module.exports = HMRClientProdShim; +export default HMRClientProdShim; diff --git a/packages/react-native/Libraries/Utilities/Platform.android.js b/packages/react-native/Libraries/Utilities/Platform.android.js index 756fd50dcf6a31..08dae07b8756a2 100644 --- a/packages/react-native/Libraries/Utilities/Platform.android.js +++ b/packages/react-native/Libraries/Utilities/Platform.android.js @@ -84,4 +84,4 @@ const Platform: PlatformType = { spec.default, }; -module.exports = Platform; +export default Platform; diff --git a/packages/react-native/Libraries/Utilities/Platform.ios.js b/packages/react-native/Libraries/Utilities/Platform.ios.js index a26a50f79460c9..03e4af59117c69 100644 --- a/packages/react-native/Libraries/Utilities/Platform.ios.js +++ b/packages/react-native/Libraries/Utilities/Platform.ios.js @@ -85,4 +85,4 @@ const Platform: PlatformType = { 'ios' in spec ? spec.ios : 'native' in spec ? spec.native : spec.default, }; -module.exports = Platform; +export default Platform; diff --git a/packages/react-native/Libraries/Utilities/Platform.js.flow b/packages/react-native/Libraries/Utilities/Platform.js.flow index fb04b1c0dcf202..d4e7c19e03408d 100644 --- a/packages/react-native/Libraries/Utilities/Platform.js.flow +++ b/packages/react-native/Libraries/Utilities/Platform.js.flow @@ -10,4 +10,4 @@ import type {Platform} from './Platform.flow'; -declare module.exports: Platform; +declare export default Platform; diff --git a/packages/react-native/Libraries/Utilities/PolyfillFunctions.js b/packages/react-native/Libraries/Utilities/PolyfillFunctions.js index 09ae9658f7b561..5731a3f4c49f32 100644 --- a/packages/react-native/Libraries/Utilities/PolyfillFunctions.js +++ b/packages/react-native/Libraries/Utilities/PolyfillFunctions.js @@ -10,7 +10,7 @@ 'use strict'; -const defineLazyObjectProperty = require('./defineLazyObjectProperty'); +const defineLazyObjectProperty = require('./defineLazyObjectProperty').default; /** * Sets an object's property. If a property with the same name exists, this will @@ -25,7 +25,7 @@ const defineLazyObjectProperty = require('./defineLazyObjectProperty'); * * @see https://github.com/facebook/react-native/issues/934 */ -function polyfillObjectProperty( +export function polyfillObjectProperty( object: {...}, name: string, getValue: () => T, @@ -49,8 +49,6 @@ function polyfillObjectProperty( }); } -function polyfillGlobal(name: string, getValue: () => T): void { +export function polyfillGlobal(name: string, getValue: () => T): void { polyfillObjectProperty(global, name, getValue); } - -module.exports = {polyfillObjectProperty, polyfillGlobal}; diff --git a/packages/react-native/Libraries/Utilities/RCTLog.js b/packages/react-native/Libraries/Utilities/RCTLog.js index 2c2f98cc0adb58..7462949c641158 100644 --- a/packages/react-native/Libraries/Utilities/RCTLog.js +++ b/packages/react-native/Libraries/Utilities/RCTLog.js @@ -53,4 +53,4 @@ const RCTLog = { }, }; -module.exports = RCTLog; +export default RCTLog; diff --git a/packages/react-native/Libraries/Utilities/SceneTracker.js b/packages/react-native/Libraries/Utilities/SceneTracker.js index 1b85f8d7dec74b..0ad62560877b21 100644 --- a/packages/react-native/Libraries/Utilities/SceneTracker.js +++ b/packages/react-native/Libraries/Utilities/SceneTracker.js @@ -39,4 +39,4 @@ const SceneTracker = { }, }; -module.exports = SceneTracker; +export default SceneTracker; diff --git a/packages/react-native/Libraries/Utilities/__mocks__/BackHandler.js b/packages/react-native/Libraries/Utilities/__mocks__/BackHandler.js index bc5bc62dfea064..426bb6ed8c6f09 100644 --- a/packages/react-native/Libraries/Utilities/__mocks__/BackHandler.js +++ b/packages/react-native/Libraries/Utilities/__mocks__/BackHandler.js @@ -42,4 +42,4 @@ const BackHandler = { }, }; -module.exports = BackHandler; +export default BackHandler; diff --git a/packages/react-native/Libraries/Utilities/__mocks__/GlobalPerformanceLogger.js b/packages/react-native/Libraries/Utilities/__mocks__/GlobalPerformanceLogger.js index 37b5d5269d3d05..973b25040675f2 100644 --- a/packages/react-native/Libraries/Utilities/__mocks__/GlobalPerformanceLogger.js +++ b/packages/react-native/Libraries/Utilities/__mocks__/GlobalPerformanceLogger.js @@ -13,4 +13,4 @@ const GlobalPerformanceLogger = jest .unmock('../createPerformanceLogger') .genMockFromModule('../GlobalPerformanceLogger'); -module.exports = GlobalPerformanceLogger; +export default GlobalPerformanceLogger; diff --git a/packages/react-native/Libraries/Utilities/__tests__/DeviceInfo-test.js b/packages/react-native/Libraries/Utilities/__tests__/DeviceInfo-test.js index 07189d2cde64ce..50a3b3f022af65 100644 --- a/packages/react-native/Libraries/Utilities/__tests__/DeviceInfo-test.js +++ b/packages/react-native/Libraries/Utilities/__tests__/DeviceInfo-test.js @@ -11,7 +11,7 @@ 'use strict'; describe('DeviceInfo', () => { - const DeviceInfo = require('../DeviceInfo'); + const DeviceInfo = require('../DeviceInfo').default; it('should give device info', () => { expect(DeviceInfo.getConstants()).toHaveProperty('Dimensions'); diff --git a/packages/react-native/Libraries/Utilities/__tests__/Dimensions-test.js b/packages/react-native/Libraries/Utilities/__tests__/Dimensions-test.js index ce71cacbdd156d..d01f88b3585e13 100644 --- a/packages/react-native/Libraries/Utilities/__tests__/Dimensions-test.js +++ b/packages/react-native/Libraries/Utilities/__tests__/Dimensions-test.js @@ -12,7 +12,7 @@ describe('Dimensions', () => { const Dimensions = require('../Dimensions').default; - const Platform = require('../Platform'); + const Platform = require('../Platform').default; it('should set window dimensions', () => { Dimensions.set({ diff --git a/packages/react-native/Libraries/Utilities/__tests__/SceneTracker-test.js b/packages/react-native/Libraries/Utilities/__tests__/SceneTracker-test.js index 44a42a52681178..f6dc21746cb90a 100644 --- a/packages/react-native/Libraries/Utilities/__tests__/SceneTracker-test.js +++ b/packages/react-native/Libraries/Utilities/__tests__/SceneTracker-test.js @@ -10,7 +10,7 @@ 'use strict'; -const SceneTracker = require('../SceneTracker'); +const SceneTracker = require('../SceneTracker').default; describe('setActiveScene', function () { it('can handle multiple listeners and unsubscribe', function () { diff --git a/packages/react-native/Libraries/Utilities/__tests__/binaryToBase64-test.js b/packages/react-native/Libraries/Utilities/__tests__/binaryToBase64-test.js index a820869b4e5f94..c752d75c798d79 100644 --- a/packages/react-native/Libraries/Utilities/__tests__/binaryToBase64-test.js +++ b/packages/react-native/Libraries/Utilities/__tests__/binaryToBase64-test.js @@ -14,7 +14,7 @@ const base64 = require('base64-js'); const {TextDecoder, TextEncoder} = require('util'); describe('binaryToBase64', () => { - const binaryToBase64 = require('../binaryToBase64'); + const binaryToBase64 = require('../binaryToBase64').default; it('should encode a Uint8Array', () => { const input = new TextEncoder().encode('Test string'); diff --git a/packages/react-native/Libraries/Utilities/__tests__/deepFreezeAndThrowOnMutationInDev-test.js b/packages/react-native/Libraries/Utilities/__tests__/deepFreezeAndThrowOnMutationInDev-test.js index 33a0482c59f78e..56f5197b51a654 100644 --- a/packages/react-native/Libraries/Utilities/__tests__/deepFreezeAndThrowOnMutationInDev-test.js +++ b/packages/react-native/Libraries/Utilities/__tests__/deepFreezeAndThrowOnMutationInDev-test.js @@ -8,7 +8,8 @@ * @oncall react_native */ -const deepFreezeAndThrowOnMutationInDev = require('../deepFreezeAndThrowOnMutationInDev'); +const deepFreezeAndThrowOnMutationInDev = + require('../deepFreezeAndThrowOnMutationInDev').default; describe('deepFreezeAndThrowOnMutationInDev', function () { it('should be a noop on non object values', () => { diff --git a/packages/react-native/Libraries/Utilities/__tests__/infoLog-test.js b/packages/react-native/Libraries/Utilities/__tests__/infoLog-test.js index 25952fa5ef2262..f06b66337ec9a4 100644 --- a/packages/react-native/Libraries/Utilities/__tests__/infoLog-test.js +++ b/packages/react-native/Libraries/Utilities/__tests__/infoLog-test.js @@ -11,7 +11,7 @@ 'use strict'; describe('infoLog', () => { - const infoLog = require('../infoLog'); + const infoLog = require('../infoLog').default; it('logs messages to the console', () => { console.log = jest.fn(); diff --git a/packages/react-native/Libraries/Utilities/__tests__/logError-test.js b/packages/react-native/Libraries/Utilities/__tests__/logError-test.js index 01fb17f5ef3470..9526a350ef344b 100644 --- a/packages/react-native/Libraries/Utilities/__tests__/logError-test.js +++ b/packages/react-native/Libraries/Utilities/__tests__/logError-test.js @@ -11,7 +11,7 @@ 'use strict'; describe('logError', () => { - const logError = require('../logError'); + const logError = require('../logError').default; it('logs error messages to the console', () => { console.error.apply = jest.fn(); diff --git a/packages/react-native/Libraries/Utilities/__tests__/mapWithSeparator-test.js b/packages/react-native/Libraries/Utilities/__tests__/mapWithSeparator-test.js index 8ec660d540cca5..2f9e50dc1cf8d2 100644 --- a/packages/react-native/Libraries/Utilities/__tests__/mapWithSeparator-test.js +++ b/packages/react-native/Libraries/Utilities/__tests__/mapWithSeparator-test.js @@ -11,7 +11,7 @@ 'use strict'; describe('mapWithSeparator', () => { - const mapWithSeparator = require('../mapWithSeparator'); + const mapWithSeparator = require('../mapWithSeparator').default; it('mapWithSeparator returns expected results', () => { const array = [1, 2, 3]; diff --git a/packages/react-native/Libraries/Utilities/__tests__/warnOnce-test.js b/packages/react-native/Libraries/Utilities/__tests__/warnOnce-test.js index ce0dd465620863..dd54a4dc898c2c 100644 --- a/packages/react-native/Libraries/Utilities/__tests__/warnOnce-test.js +++ b/packages/react-native/Libraries/Utilities/__tests__/warnOnce-test.js @@ -11,7 +11,7 @@ 'use strict'; describe('warnOnce', () => { - const warnOnce = require('../warnOnce'); + const warnOnce = require('../warnOnce').default; it('logs warning messages to the console exactly once', () => { jest.spyOn(console, 'warn').mockReturnValue(undefined); diff --git a/packages/react-native/Libraries/Utilities/binaryToBase64.js b/packages/react-native/Libraries/Utilities/binaryToBase64.js index 898a5cf744081c..9c606762fa248f 100644 --- a/packages/react-native/Libraries/Utilities/binaryToBase64.js +++ b/packages/react-native/Libraries/Utilities/binaryToBase64.js @@ -28,4 +28,4 @@ function binaryToBase64(data: ArrayBuffer | $ArrayBufferView): string { return base64.fromByteArray(new Uint8Array(buffer, byteOffset, byteLength)); } -module.exports = binaryToBase64; +export default binaryToBase64; diff --git a/packages/react-native/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js b/packages/react-native/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js index 51eac5cbaf299d..2490c172febaed 100644 --- a/packages/react-native/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js +++ b/packages/react-native/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js @@ -87,4 +87,4 @@ function identity(value: mixed) { return value; } -module.exports = deepFreezeAndThrowOnMutationInDev; +export default deepFreezeAndThrowOnMutationInDev; diff --git a/packages/react-native/Libraries/Utilities/defineLazyObjectProperty.js b/packages/react-native/Libraries/Utilities/defineLazyObjectProperty.js index 31e94f282686a9..188f118526623a 100644 --- a/packages/react-native/Libraries/Utilities/defineLazyObjectProperty.js +++ b/packages/react-native/Libraries/Utilities/defineLazyObjectProperty.js @@ -63,4 +63,4 @@ function defineLazyObjectProperty( }); } -module.exports = defineLazyObjectProperty; +export default defineLazyObjectProperty; diff --git a/packages/react-native/Libraries/Utilities/differ/__tests__/deepDiffer-test.js b/packages/react-native/Libraries/Utilities/differ/__tests__/deepDiffer-test.js index 0129e9d5ee1c6f..dd96ea35be95ea 100644 --- a/packages/react-native/Libraries/Utilities/differ/__tests__/deepDiffer-test.js +++ b/packages/react-native/Libraries/Utilities/differ/__tests__/deepDiffer-test.js @@ -10,7 +10,7 @@ 'use strict'; -const deepDiffer = require('../deepDiffer'); +const deepDiffer = require('../deepDiffer').default; describe('deepDiffer', function () { it('should diff primitives of the same type', () => { diff --git a/packages/react-native/Libraries/Utilities/differ/__tests__/matricesDiffer-test.js b/packages/react-native/Libraries/Utilities/differ/__tests__/matricesDiffer-test.js index 8512db2040d791..dffe86fb5c2448 100644 --- a/packages/react-native/Libraries/Utilities/differ/__tests__/matricesDiffer-test.js +++ b/packages/react-native/Libraries/Utilities/differ/__tests__/matricesDiffer-test.js @@ -10,7 +10,7 @@ 'use strict'; -const matricesDiffer = require('../matricesDiffer'); +const matricesDiffer = require('../matricesDiffer').default; describe('matricesDiffer', function () { it('diffs matrices with single element', () => { diff --git a/packages/react-native/Libraries/Utilities/differ/deepDiffer.js b/packages/react-native/Libraries/Utilities/differ/deepDiffer.js index b0af0244a65487..82c87aa7115455 100644 --- a/packages/react-native/Libraries/Utilities/differ/deepDiffer.js +++ b/packages/react-native/Libraries/Utilities/differ/deepDiffer.js @@ -98,4 +98,4 @@ const deepDiffer = function ( }; deepDiffer.unstable_setLogListeners = unstable_setLogListeners; -module.exports = deepDiffer; +export default deepDiffer; diff --git a/packages/react-native/Libraries/Utilities/differ/insetsDiffer.js b/packages/react-native/Libraries/Utilities/differ/insetsDiffer.js index 4ec01330fbb55d..f29fa676f92a0b 100644 --- a/packages/react-native/Libraries/Utilities/differ/insetsDiffer.js +++ b/packages/react-native/Libraries/Utilities/differ/insetsDiffer.js @@ -37,4 +37,4 @@ const insetsDiffer = function (one: Inset, two: Inset): boolean { ); }; -module.exports = insetsDiffer; +export default insetsDiffer; diff --git a/packages/react-native/Libraries/Utilities/differ/matricesDiffer.js b/packages/react-native/Libraries/Utilities/differ/matricesDiffer.js index 0abbe898f5249b..a897081141be42 100644 --- a/packages/react-native/Libraries/Utilities/differ/matricesDiffer.js +++ b/packages/react-native/Libraries/Utilities/differ/matricesDiffer.js @@ -48,4 +48,4 @@ const matricesDiffer = function ( ); }; -module.exports = matricesDiffer; +export default matricesDiffer; diff --git a/packages/react-native/Libraries/Utilities/differ/pointsDiffer.js b/packages/react-native/Libraries/Utilities/differ/pointsDiffer.js index 2039b49511fc3f..8a51999a5f880d 100644 --- a/packages/react-native/Libraries/Utilities/differ/pointsDiffer.js +++ b/packages/react-native/Libraries/Utilities/differ/pointsDiffer.js @@ -24,4 +24,4 @@ const pointsDiffer = function (one: ?Point, two: ?Point): boolean { return one !== two && (one.x !== two.x || one.y !== two.y); }; -module.exports = pointsDiffer; +export default pointsDiffer; diff --git a/packages/react-native/Libraries/Utilities/differ/sizesDiffer.js b/packages/react-native/Libraries/Utilities/differ/sizesDiffer.js index a4c3a1fb3d0688..2e8fb0d6254986 100644 --- a/packages/react-native/Libraries/Utilities/differ/sizesDiffer.js +++ b/packages/react-native/Libraries/Utilities/differ/sizesDiffer.js @@ -23,4 +23,4 @@ const sizesDiffer = function (one: Size, two: Size): boolean { ); }; -module.exports = sizesDiffer; +export default sizesDiffer; diff --git a/packages/react-native/Libraries/Utilities/dismissKeyboard.js b/packages/react-native/Libraries/Utilities/dismissKeyboard.js index fd14c37bdc4a29..5d6e455df9d9ed 100644 --- a/packages/react-native/Libraries/Utilities/dismissKeyboard.js +++ b/packages/react-native/Libraries/Utilities/dismissKeyboard.js @@ -18,4 +18,4 @@ function dismissKeyboard() { TextInputState.blurTextInput(TextInputState.currentlyFocusedInput()); } -module.exports = dismissKeyboard; +export default dismissKeyboard; diff --git a/packages/react-native/Libraries/Utilities/infoLog.js b/packages/react-native/Libraries/Utilities/infoLog.js index 6cb6df8d414971..7f2a63e0cd8448 100644 --- a/packages/react-native/Libraries/Utilities/infoLog.js +++ b/packages/react-native/Libraries/Utilities/infoLog.js @@ -17,4 +17,4 @@ function infoLog(...args: Array): void { return console.log(...args); } -module.exports = infoLog; +export default infoLog; diff --git a/packages/react-native/Libraries/Utilities/logError.js b/packages/react-native/Libraries/Utilities/logError.js index 9b79f1de2765a1..35ec8c99700c8f 100644 --- a/packages/react-native/Libraries/Utilities/logError.js +++ b/packages/react-native/Libraries/Utilities/logError.js @@ -15,13 +15,13 @@ * `console.error` as a failure callback - it's not properly bound. If passes an * `Error` object, it will print the message and stack. */ -const logError = function (...args: $ReadOnlyArray) { +export function logError(...args: $ReadOnlyArray) { if (args.length === 1 && args[0] instanceof Error) { const err = args[0]; console.error('Error: "' + err.message + '". Stack:\n' + err.stack); } else { console.error.apply(console, args); } -}; +} -module.exports = logError; +export default logError; diff --git a/packages/react-native/Libraries/Utilities/mapWithSeparator.js b/packages/react-native/Libraries/Utilities/mapWithSeparator.js index e611c6b94eba5e..822d45936d8f47 100644 --- a/packages/react-native/Libraries/Utilities/mapWithSeparator.js +++ b/packages/react-native/Libraries/Utilities/mapWithSeparator.js @@ -25,4 +25,4 @@ function mapWithSeparator( return mapped; } -module.exports = mapWithSeparator; +export default mapWithSeparator; diff --git a/packages/react-native/Libraries/Utilities/warnOnce.js b/packages/react-native/Libraries/Utilities/warnOnce.js index a77f47e2f96322..4a78ed4e7d38bb 100644 --- a/packages/react-native/Libraries/Utilities/warnOnce.js +++ b/packages/react-native/Libraries/Utilities/warnOnce.js @@ -29,4 +29,4 @@ function warnOnce(key: string, message: string) { warnedKeys[key] = true; } -module.exports = warnOnce; +export default warnOnce; diff --git a/packages/react-native/Libraries/Vibration/Vibration.js b/packages/react-native/Libraries/Vibration/Vibration.js index db124c63235c42..ca2b5f2a28e4fa 100644 --- a/packages/react-native/Libraries/Vibration/Vibration.js +++ b/packages/react-native/Libraries/Vibration/Vibration.js @@ -11,7 +11,7 @@ import NativeVibration from './NativeVibration'; -const Platform = require('../Utilities/Platform'); +const Platform = require('../Utilities/Platform').default; /** * Vibration API 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 18454723d2ed80..5556cbcc4f96f1 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 @@ -8911,7 +8911,7 @@ type TBackHandler = {| handler: () => ?boolean ) => { remove: () => void, ... }, |}; -declare module.exports: TBackHandler; +declare export default TBackHandler; " `; @@ -8921,7 +8921,7 @@ exports[`public API should not change unintentionally Libraries/Utilities/DebugE `; exports[`public API should not change unintentionally Libraries/Utilities/DevLoadingView.js 1`] = ` -"declare module.exports: { +"declare export default { showMessage(message: string, type: \\"load\\" | \\"refresh\\"): void, hide(): void, }; @@ -8934,12 +8934,12 @@ exports[`public API should not change unintentionally Libraries/Utilities/DevSet reload(reason?: string): void, onFastRefresh(): void, }; -declare module.exports: DevSettings; +declare export default typeof DevSettings; " `; exports[`public API should not change unintentionally Libraries/Utilities/DeviceInfo.js 1`] = ` -"declare module.exports: NativeDeviceInfo; +"declare export default typeof NativeDeviceInfo; " `; @@ -8954,18 +8954,17 @@ declare export default typeof Dimensions; `; exports[`public API should not change unintentionally Libraries/Utilities/FeatureDetection.js 1`] = ` -"declare function isNativeFunction(f: Function): boolean; -declare function hasNativeConstructor(o: Object, expectedName: string): boolean; -declare module.exports: { - isNativeFunction: isNativeFunction, - hasNativeConstructor: hasNativeConstructor, -}; +"declare export function isNativeFunction(f: Function): boolean; +declare export function hasNativeConstructor( + o: Object, + expectedName: string +): boolean; " `; exports[`public API should not change unintentionally Libraries/Utilities/GlobalPerformanceLogger.js 1`] = ` "declare const GlobalPerformanceLogger: IPerformanceLogger; -declare module.exports: GlobalPerformanceLogger; +declare export default typeof GlobalPerformanceLogger; " `; @@ -8996,13 +8995,13 @@ export type HMRClientNativeInterface = {| unstable_notifyFuseboxConsoleEnabled(): void, |}; declare const HMRClient: HMRClientNativeInterface; -declare module.exports: HMRClient; +declare export default typeof HMRClient; " `; exports[`public API should not change unintentionally Libraries/Utilities/HMRClientProdShim.js 1`] = ` "declare const HMRClientProdShim: HMRClientNativeInterface; -declare module.exports: HMRClientProdShim; +declare export default typeof HMRClientProdShim; " `; @@ -9163,21 +9162,20 @@ export type Platform = IOSPlatform | AndroidPlatform; `; exports[`public API should not change unintentionally Libraries/Utilities/Platform.js.flow 1`] = ` -"declare module.exports: Platform; +"declare export default Platform; " `; exports[`public API should not change unintentionally Libraries/Utilities/PolyfillFunctions.js 1`] = ` -"declare function polyfillObjectProperty( +"declare export function polyfillObjectProperty( object: { ... }, name: string, getValue: () => T ): void; -declare function polyfillGlobal(name: string, getValue: () => T): void; -declare module.exports: { - polyfillObjectProperty: polyfillObjectProperty, - polyfillGlobal: polyfillGlobal, -}; +declare export function polyfillGlobal( + name: string, + getValue: () => T +): void; " `; @@ -9188,7 +9186,7 @@ declare const RCTLog: { logToConsole(level: string, ...args: Array): void, setWarningHandler(handler: typeof warningHandler): void, }; -declare module.exports: RCTLog; +declare export default typeof RCTLog; " `; @@ -9248,13 +9246,13 @@ declare const SceneTracker: { ... }, }; -declare module.exports: SceneTracker; +declare export default typeof SceneTracker; " `; exports[`public API should not change unintentionally Libraries/Utilities/binaryToBase64.js 1`] = ` "declare function binaryToBase64(data: ArrayBuffer | $ArrayBufferView): string; -declare module.exports: binaryToBase64; +declare export default typeof binaryToBase64; " `; @@ -9296,7 +9294,7 @@ exports[`public API should not change unintentionally Libraries/Utilities/deepFr "declare function deepFreezeAndThrowOnMutationInDev>( object: T ): T; -declare module.exports: deepFreezeAndThrowOnMutationInDev; +declare export default typeof deepFreezeAndThrowOnMutationInDev; " `; @@ -9311,7 +9309,7 @@ exports[`public API should not change unintentionally Libraries/Utilities/define ... } ): void; -declare module.exports: defineLazyObjectProperty; +declare export default typeof defineLazyObjectProperty; " `; @@ -9323,7 +9321,7 @@ declare const deepDiffer: ( maxDepthOrOptions: Options | number, maybeOptions?: Options ) => boolean; -declare module.exports: deepDiffer; +declare export default typeof deepDiffer; " `; @@ -9336,7 +9334,7 @@ exports[`public API should not change unintentionally Libraries/Utilities/differ ... }; declare const insetsDiffer: (one: Inset, two: Inset) => boolean; -declare module.exports: insetsDiffer; +declare export default typeof insetsDiffer; " `; @@ -9345,7 +9343,7 @@ exports[`public API should not change unintentionally Libraries/Utilities/differ one: ?Array, two: ?Array ) => boolean; -declare module.exports: matricesDiffer; +declare export default typeof matricesDiffer; " `; @@ -9356,32 +9354,32 @@ exports[`public API should not change unintentionally Libraries/Utilities/differ ... }; declare const pointsDiffer: (one: ?Point, two: ?Point) => boolean; -declare module.exports: pointsDiffer; +declare export default typeof pointsDiffer; " `; exports[`public API should not change unintentionally Libraries/Utilities/differ/sizesDiffer.js 1`] = ` "type Size = { width: ?number, height: ?number }; declare const sizesDiffer: (one: Size, two: Size) => boolean; -declare module.exports: sizesDiffer; +declare export default typeof sizesDiffer; " `; exports[`public API should not change unintentionally Libraries/Utilities/dismissKeyboard.js 1`] = ` "declare function dismissKeyboard(): void; -declare module.exports: dismissKeyboard; +declare export default typeof dismissKeyboard; " `; exports[`public API should not change unintentionally Libraries/Utilities/infoLog.js 1`] = ` "declare function infoLog(...args: Array): void; -declare module.exports: infoLog; +declare export default typeof infoLog; " `; exports[`public API should not change unintentionally Libraries/Utilities/logError.js 1`] = ` -"declare const logError: (...args: $ReadOnlyArray) => void; -declare module.exports: logError; +"declare export function logError(...args: $ReadOnlyArray): void; +declare export default typeof logError; " `; @@ -9391,7 +9389,7 @@ exports[`public API should not change unintentionally Libraries/Utilities/mapWit itemRenderer: (item: TFrom, index: number, items: Array) => TTo, spacerRenderer: (index: number) => TTo ): Array; -declare module.exports: mapWithSeparator; +declare export default typeof mapWithSeparator; " `; @@ -9441,7 +9439,7 @@ exports[`public API should not change unintentionally Libraries/Utilities/useWin exports[`public API should not change unintentionally Libraries/Utilities/warnOnce.js 1`] = ` "declare function warnOnce(key: string, message: string): void; -declare module.exports: warnOnce; +declare export default typeof warnOnce; " `; diff --git a/packages/react-native/index.js b/packages/react-native/index.js index 31f568698f6f2a..1beaeffbbac19b 100644 --- a/packages/react-native/index.js +++ b/packages/react-native/index.js @@ -99,7 +99,7 @@ import typeof Vibration from './Libraries/Vibration/Vibration'; import typeof YellowBox from './Libraries/YellowBox/YellowBoxDeprecated'; import typeof DevMenu from './src/private/devmenu/DevMenu'; -const warnOnce = require('./Libraries/Utilities/warnOnce'); +const warnOnce = require('./Libraries/Utilities/warnOnce').default; const invariant = require('invariant'); export type {HostComponent, HostInstance}; @@ -233,7 +233,7 @@ module.exports = { return require('./Libraries/AppState/AppState'); }, get BackHandler(): BackHandler { - return require('./Libraries/Utilities/BackHandler'); + return require('./Libraries/Utilities/BackHandler').default; }, get Clipboard(): Clipboard { warnOnce( @@ -245,13 +245,13 @@ module.exports = { return require('./Libraries/Components/Clipboard/Clipboard'); }, get DeviceInfo(): DeviceInfo { - return require('./Libraries/Utilities/DeviceInfo'); + return require('./Libraries/Utilities/DeviceInfo').default; }, get DevMenu(): DevMenu { return require('./src/private/devmenu/DevMenu'); }, get DevSettings(): DevSettings { - return require('./Libraries/Utilities/DevSettings'); + return require('./Libraries/Utilities/DevSettings').default; }, get Dimensions(): Dimensions { return require('./Libraries/Utilities/Dimensions').default; @@ -371,7 +371,7 @@ module.exports = { return require('./Libraries/BatchedBridge/NativeModules'); }, get Platform(): Platform { - return require('./Libraries/Utilities/Platform'); + return require('./Libraries/Utilities/Platform').default; }, get PlatformColor(): PlatformColor { return require('./Libraries/StyleSheet/PlatformColorValueTypes') diff --git a/packages/react-native/src/private/specs/modules/NativeExceptionsManager.js b/packages/react-native/src/private/specs/modules/NativeExceptionsManager.js index 0b684c681e7071..a44c56dcbf8c0c 100644 --- a/packages/react-native/src/private/specs/modules/NativeExceptionsManager.js +++ b/packages/react-native/src/private/specs/modules/NativeExceptionsManager.js @@ -12,7 +12,7 @@ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport'; import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry'; -const Platform = require('../../../../Libraries/Utilities/Platform'); +const Platform = require('../../../../Libraries/Utilities/Platform').default; export type StackFrame = {| column: ?number, diff --git a/packages/rn-tester/IntegrationTests/AppEventsTest.js b/packages/rn-tester/IntegrationTests/AppEventsTest.js index 0853b9edc99def..1573d40f5ce201 100644 --- a/packages/rn-tester/IntegrationTests/AppEventsTest.js +++ b/packages/rn-tester/IntegrationTests/AppEventsTest.js @@ -12,7 +12,8 @@ const React = require('react'); const ReactNative = require('react-native'); -const deepDiffer = require('react-native/Libraries/Utilities/differ/deepDiffer'); +const deepDiffer = + require('react-native/Libraries/Utilities/differ/deepDiffer').default; const {NativeAppEventEmitter, StyleSheet, Text, View} = ReactNative; const {TestModule} = ReactNative.NativeModules; diff --git a/packages/rn-tester/IntegrationTests/LayoutEventsTest.js b/packages/rn-tester/IntegrationTests/LayoutEventsTest.js index 0729487636372f..d43ac03319c0a3 100644 --- a/packages/rn-tester/IntegrationTests/LayoutEventsTest.js +++ b/packages/rn-tester/IntegrationTests/LayoutEventsTest.js @@ -18,7 +18,8 @@ import type { const React = require('react'); const ReactNative = require('react-native'); -const deepDiffer = require('react-native/Libraries/Utilities/differ/deepDiffer'); +const deepDiffer = + require('react-native/Libraries/Utilities/differ/deepDiffer').default; const {Image, LayoutAnimation, StyleSheet, Text, View} = ReactNative; const {TestModule} = ReactNative.NativeModules; diff --git a/packages/rn-tester/js/examples/FlatList/FlatList-multiColumn.js b/packages/rn-tester/js/examples/FlatList/FlatList-multiColumn.js index 89e124c6dc33b8..7dbdf891161094 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatList-multiColumn.js +++ b/packages/rn-tester/js/examples/FlatList/FlatList-multiColumn.js @@ -28,7 +28,7 @@ const { const RNTesterPage = require('../../components/RNTesterPage'); const React = require('react'); const {Alert, FlatList, StyleSheet, Text, View} = require('react-native'); -const infoLog = require('react-native/Libraries/Utilities/infoLog'); +const infoLog = require('react-native/Libraries/Utilities/infoLog').default; class MultiColumnExample extends React.PureComponent< $FlowFixMeProps,