diff --git a/packages/react-native/Libraries/Alert/Alert.js b/packages/react-native/Libraries/Alert/Alert.js index df9908ebd15..b920784d3a6 100644 --- a/packages/react-native/Libraries/Alert/Alert.js +++ b/packages/react-native/Libraries/Alert/Alert.js @@ -10,9 +10,10 @@ import type {DialogOptions} from '../NativeModules/specs/NativeDialogManagerAndroid'; -import Platform from '../Utilities/Platform'; import {alertWithArgs} from './RCTAlertManager'; +const Platform = require('../Utilities/Platform').default; + /** * @platform ios */ diff --git a/packages/react-native/Libraries/Animated/AnimatedExports.js b/packages/react-native/Libraries/Animated/AnimatedExports.js index d767e8a15bc..061438863c6 100644 --- a/packages/react-native/Libraries/Animated/AnimatedExports.js +++ b/packages/react-native/Libraries/Animated/AnimatedExports.js @@ -15,10 +15,11 @@ import typeof AnimatedSectionList from './components/AnimatedSectionList'; import typeof AnimatedText from './components/AnimatedText'; import typeof AnimatedView from './components/AnimatedView'; -import Platform from '../Utilities/Platform'; import AnimatedImplementation from './AnimatedImplementation'; import AnimatedMock from './AnimatedMock'; +const Platform = require('../Utilities/Platform').default; + const Animated: typeof AnimatedImplementation = Platform.isDisableAnimations ? AnimatedMock : AnimatedImplementation; diff --git a/packages/react-native/Libraries/Animated/components/AnimatedScrollView.js b/packages/react-native/Libraries/Animated/components/AnimatedScrollView.js index 7a1a1d7b32e..ed4c12e49e0 100644 --- a/packages/react-native/Libraries/Animated/components/AnimatedScrollView.js +++ b/packages/react-native/Libraries/Animated/components/AnimatedScrollView.js @@ -21,13 +21,14 @@ import ScrollView, { import flattenStyle from '../../StyleSheet/flattenStyle'; import splitLayoutProps from '../../StyleSheet/splitLayoutProps'; import StyleSheet from '../../StyleSheet/StyleSheet'; -import Platform from '../../Utilities/Platform'; import useMergeRefs from '../../Utilities/useMergeRefs'; import createAnimatedComponent from '../createAnimatedComponent'; import useAnimatedProps from '../useAnimatedProps'; import * as React from 'react'; import {cloneElement, useMemo} from 'react'; +const Platform = require('../../Utilities/Platform').default; + type AnimatedScrollViewInstance = React.ElementRef; /** diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedStyle.js b/packages/react-native/Libraries/Animated/nodes/AnimatedStyle.js index 3b04b8ba283..c8d4d91487c 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedStyle.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedStyle.js @@ -13,12 +13,13 @@ import type {AnimatedNodeConfig} from './AnimatedNode'; import {validateStyles} from '../../../src/private/animated/NativeAnimatedValidation'; import * as ReactNativeFeatureFlags from '../../../src/private/featureflags/ReactNativeFeatureFlags'; -import Platform from '../../Utilities/Platform'; import AnimatedNode from './AnimatedNode'; import AnimatedObject from './AnimatedObject'; import AnimatedTransform from './AnimatedTransform'; import AnimatedWithChildren from './AnimatedWithChildren'; +const Platform = require('../../Utilities/Platform').default; + export type AnimatedStyleAllowlist = Readonly<{[string]: true}>; type FlatStyle = {[string]: unknown}; diff --git a/packages/react-native/Libraries/Animated/shouldUseTurboAnimatedModule.js b/packages/react-native/Libraries/Animated/shouldUseTurboAnimatedModule.js index 2758cc73469..c6fb17ba086 100644 --- a/packages/react-native/Libraries/Animated/shouldUseTurboAnimatedModule.js +++ b/packages/react-native/Libraries/Animated/shouldUseTurboAnimatedModule.js @@ -9,7 +9,8 @@ */ import * as ReactNativeFeatureFlags from '../../src/private/featureflags/ReactNativeFeatureFlags'; -import Platform from '../Utilities/Platform'; + +const Platform = require('../Utilities/Platform').default; function shouldUseTurboAnimatedModule(): boolean { if (ReactNativeFeatureFlags.cxxNativeAnimatedEnabled()) { diff --git a/packages/react-native/Libraries/AppState/AppState.js b/packages/react-native/Libraries/AppState/AppState.js index ed7909a54c6..2295cd778d2 100644 --- a/packages/react-native/Libraries/AppState/AppState.js +++ b/packages/react-native/Libraries/AppState/AppState.js @@ -10,10 +10,11 @@ import NativeEventEmitter from '../EventEmitter/NativeEventEmitter'; import logError from '../Utilities/logError'; -import Platform from '../Utilities/Platform'; import {type EventSubscription} from '../vendor/emitter/EventEmitter'; import NativeAppState from './NativeAppState'; +const Platform = require('../Utilities/Platform').default; + /** * active - The app is running in the foreground * background - The app is running in the background. The user is either: diff --git a/packages/react-native/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js b/packages/react-native/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js index 7f9a2224b1a..b403d8f4238 100644 --- a/packages/react-native/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +++ b/packages/react-native/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js @@ -13,11 +13,12 @@ import type {EventSubscription} from '../../vendor/emitter/EventEmitter'; import RCTDeviceEventEmitter from '../../EventEmitter/RCTDeviceEventEmitter'; import {sendAccessibilityEvent} from '../../ReactNative/RendererProxy'; -import Platform from '../../Utilities/Platform'; import legacySendAccessibilityEvent from './legacySendAccessibilityEvent'; import NativeAccessibilityInfoAndroid from './NativeAccessibilityInfo'; import NativeAccessibilityManagerIOS from './NativeAccessibilityManager'; +const Platform = require('../../Utilities/Platform').default; + // Events that are only supported on Android. type AccessibilityEventDefinitionsAndroid = { accessibilityServiceChanged: [boolean], diff --git a/packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.js b/packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.js index 63bddf2e950..bf3e0a84117 100644 --- a/packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.js +++ b/packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.js @@ -13,10 +13,11 @@ import type {HostInstance} from '../../../src/private/types/HostInstance'; import type {ViewProps} from '../View/ViewPropTypes'; import StyleSheet, {type ColorValue} from '../../StyleSheet/StyleSheet'; -import Platform from '../../Utilities/Platform'; import View from '../View/View'; import * as React from 'react'; +const Platform = require('../../Utilities/Platform').default; + export type ActivityIndicatorInstance = HostInstance; const PlatformActivityIndicator = diff --git a/packages/react-native/Libraries/Components/Button.js b/packages/react-native/Libraries/Components/Button.js index 8ed215d6a6c..a326a6991a4 100644 --- a/packages/react-native/Libraries/Components/Button.js +++ b/packages/react-native/Libraries/Components/Button.js @@ -20,13 +20,14 @@ import type { import StyleSheet, {type ColorValue} from '../StyleSheet/StyleSheet'; import Text from '../Text/Text'; -import Platform from '../Utilities/Platform'; import TouchableNativeFeedback from './Touchable/TouchableNativeFeedback'; import TouchableOpacity from './Touchable/TouchableOpacity'; import View from './View/View'; import invariant from 'invariant'; import * as React from 'react'; +const Platform = require('../Utilities/Platform').default; + /** @build-types emit-as-interface Uniwind compatibility */ export type ButtonProps = Readonly<{ /** diff --git a/packages/react-native/Libraries/Components/Keyboard/Keyboard.js b/packages/react-native/Libraries/Components/Keyboard/Keyboard.js index 685c3a7018d..fc2b2c28c3d 100644 --- a/packages/react-native/Libraries/Components/Keyboard/Keyboard.js +++ b/packages/react-native/Libraries/Components/Keyboard/Keyboard.js @@ -13,9 +13,10 @@ import type {EventSubscription} from '../../vendor/emitter/EventEmitter'; import NativeEventEmitter from '../../EventEmitter/NativeEventEmitter'; import LayoutAnimation from '../../LayoutAnimation/LayoutAnimation'; import dismissKeyboard from '../../Utilities/dismissKeyboard'; -import Platform from '../../Utilities/Platform'; import NativeKeyboardObserver from './NativeKeyboardObserver'; +const Platform = require('../../Utilities/Platform').default; + export type KeyboardEventName = keyof KeyboardEventDefinitions; export type KeyboardEventEasing = diff --git a/packages/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js b/packages/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js index 87ac6de0665..37340bde511 100644 --- a/packages/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js +++ b/packages/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js @@ -18,7 +18,6 @@ import type {KeyboardEvent, KeyboardMetrics} from './Keyboard'; import LayoutAnimation from '../../LayoutAnimation/LayoutAnimation'; import StyleSheet from '../../StyleSheet/StyleSheet'; -import Platform from '../../Utilities/Platform'; import {type EventSubscription} from '../../vendor/emitter/EventEmitter'; import AccessibilityInfo from '../AccessibilityInfo/AccessibilityInfo'; import View from '../View/View'; @@ -26,6 +25,8 @@ import Keyboard from './Keyboard'; import * as React from 'react'; import {createRef} from 'react'; +const Platform = require('../../Utilities/Platform').default; + /** @build-types emit-as-interface Uniwind compatibility */ export type KeyboardAvoidingViewProps = Readonly<{ ...ViewProps, diff --git a/packages/react-native/Libraries/Components/Pressable/__tests__/Pressable-test.js b/packages/react-native/Libraries/Components/Pressable/__tests__/Pressable-test.js index 8eb24e747bd..baa3e2a14f2 100644 --- a/packages/react-native/Libraries/Components/Pressable/__tests__/Pressable-test.js +++ b/packages/react-native/Libraries/Components/Pressable/__tests__/Pressable-test.js @@ -9,12 +9,13 @@ */ import {PlatformColor} from '../../../StyleSheet/PlatformColorValueTypes'; -import Platform from '../../../Utilities/Platform'; import {expectRendersMatchingSnapshot} from '../../../Utilities/ReactNativeTestTools'; import View from '../../View/View'; import Pressable from '../Pressable'; import * as React from 'react'; +const Platform = require('../../../Utilities/Platform').default; + describe('', () => { it('should render as expected', async () => { await expectRendersMatchingSnapshot( diff --git a/packages/react-native/Libraries/Components/Pressable/useAndroidRippleForView.js b/packages/react-native/Libraries/Components/Pressable/useAndroidRippleForView.js index 4047f57bd9f..8e6727c4cf4 100644 --- a/packages/react-native/Libraries/Components/Pressable/useAndroidRippleForView.js +++ b/packages/react-native/Libraries/Components/Pressable/useAndroidRippleForView.js @@ -13,12 +13,13 @@ import type {ColorValue} from '../../StyleSheet/StyleSheet'; import type {GestureResponderEvent} from '../../Types/CoreEventTypes'; import processColor from '../../StyleSheet/processColor'; -import Platform from '../../Utilities/Platform'; import View from '../View/View'; import {Commands} from '../View/ViewNativeComponent'; import * as React from 'react'; import {useMemo} from 'react'; +const Platform = require('../../Utilities/Platform').default; + type NativeBackgroundProp = Readonly<{ type: 'RippleAndroid', color: ?ProcessedColorValue, diff --git a/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js b/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js index 1a6bd48ab1b..56db4607a43 100644 --- a/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +++ b/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js @@ -13,7 +13,7 @@ import type {HostInstance} from '../../../src/private/types/HostInstance'; import type {ProgressBarAndroidProps} from './ProgressBarAndroidTypes'; -import Platform from '../../Utilities/Platform'; +const Platform = require('../../Utilities/Platform').default; export type ProgressBarAndroidInstance = HostInstance; diff --git a/packages/react-native/Libraries/Components/SafeAreaView/SafeAreaView.js b/packages/react-native/Libraries/Components/SafeAreaView/SafeAreaView.js index b6f5a47aaf7..72f435b7075 100644 --- a/packages/react-native/Libraries/Components/SafeAreaView/SafeAreaView.js +++ b/packages/react-native/Libraries/Components/SafeAreaView/SafeAreaView.js @@ -11,10 +11,11 @@ import type {HostInstance} from '../../../src/private/types/HostInstance'; import type {ViewProps} from '../View/ViewPropTypes'; -import Platform from '../../Utilities/Platform'; import View from '../View/View'; import * as React from 'react'; +const Platform = require('../../Utilities/Platform').default; + export type SafeAreaViewInstance = HostInstance; /** diff --git a/packages/react-native/Libraries/Components/ScrollView/ScrollView.js b/packages/react-native/Libraries/Components/ScrollView/ScrollView.js index 4f3a4fe3bb8..48d3e825f07 100644 --- a/packages/react-native/Libraries/Components/ScrollView/ScrollView.js +++ b/packages/react-native/Libraries/Components/ScrollView/ScrollView.js @@ -40,7 +40,6 @@ import splitLayoutProps from '../../StyleSheet/splitLayoutProps'; import StyleSheet from '../../StyleSheet/StyleSheet'; import Dimensions from '../../Utilities/Dimensions'; import dismissKeyboard from '../../Utilities/dismissKeyboard'; -import Platform from '../../Utilities/Platform'; import Keyboard from '../Keyboard/Keyboard'; import TextInputState from '../TextInput/TextInputState'; import View from '../View/View'; @@ -54,6 +53,8 @@ import nullthrows from 'nullthrows'; import * as React from 'react'; import {cloneElement} from 'react'; +const Platform = require('../../Utilities/Platform').default; + /* * iOS scroll event timing nuances: * =============================== diff --git a/packages/react-native/Libraries/Components/ScrollView/ScrollViewNativeComponent.js b/packages/react-native/Libraries/Components/ScrollView/ScrollViewNativeComponent.js index eeee1a603e7..4ca258f3a95 100644 --- a/packages/react-native/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +++ b/packages/react-native/Libraries/Components/ScrollView/ScrollViewNativeComponent.js @@ -14,9 +14,10 @@ import type {ScrollViewNativeProps as Props} from './ScrollViewNativeComponentTy import * as NativeComponentRegistry from '../../NativeComponent/NativeComponentRegistry'; import {ConditionallyIgnoredEventHandlers} from '../../NativeComponent/ViewConfigIgnore'; -import Platform from '../../Utilities/Platform'; import {colorAttribute} from '../View/ReactNativeStyleAttributes'; +const Platform = require('../../Utilities/Platform').default; + export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = Platform.OS === 'android' ? { diff --git a/packages/react-native/Libraries/Components/ScrollView/ScrollViewStickyHeader.js b/packages/react-native/Libraries/Components/ScrollView/ScrollViewStickyHeader.js index 692b4b7e63a..2afb6edbc71 100644 --- a/packages/react-native/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +++ b/packages/react-native/Libraries/Components/ScrollView/ScrollViewStickyHeader.js @@ -13,7 +13,6 @@ import type {LayoutChangeEvent} from '../../Types/CoreEventTypes'; import Animated from '../../Animated/Animated'; import {isPublicInstance as isFabricPublicInstance} from '../../ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstanceUtils'; import StyleSheet from '../../StyleSheet/StyleSheet'; -import Platform from '../../Utilities/Platform'; import useMergeRefs from '../../Utilities/useMergeRefs'; import * as React from 'react'; import { @@ -25,6 +24,8 @@ import { useState, } from 'react'; +const Platform = require('../../Utilities/Platform').default; + export type ScrollViewStickyHeaderProps = Readonly<{ children?: React.Node, nextHeaderLayoutY: ?number, diff --git a/packages/react-native/Libraries/Components/ScrollView/processDecelerationRate.js b/packages/react-native/Libraries/Components/ScrollView/processDecelerationRate.js index f9806beb329..f5448737d49 100644 --- a/packages/react-native/Libraries/Components/ScrollView/processDecelerationRate.js +++ b/packages/react-native/Libraries/Components/ScrollView/processDecelerationRate.js @@ -8,7 +8,7 @@ * @format */ -import Platform from '../../Utilities/Platform'; +const Platform = require('../../Utilities/Platform').default; function processDecelerationRate( decelerationRate: number | 'normal' | 'fast', diff --git a/packages/react-native/Libraries/Components/StatusBar/StatusBar.js b/packages/react-native/Libraries/Components/StatusBar/StatusBar.js index 2145d12fbf5..cba068175e4 100644 --- a/packages/react-native/Libraries/Components/StatusBar/StatusBar.js +++ b/packages/react-native/Libraries/Components/StatusBar/StatusBar.js @@ -13,12 +13,13 @@ import type {EventSubscription} from '../../vendor/emitter/EventEmitter'; import processColor from '../../StyleSheet/processColor'; import * as Appearance from '../../Utilities/Appearance'; -import Platform from '../../Utilities/Platform'; import NativeStatusBarManagerAndroid from './NativeStatusBarManagerAndroid'; import NativeStatusBarManagerIOS from './NativeStatusBarManagerIOS'; import invariant from 'invariant'; import * as React from 'react'; +const Platform = require('../../Utilities/Platform').default; + /** * Status bar style */ diff --git a/packages/react-native/Libraries/Components/Switch/Switch.js b/packages/react-native/Libraries/Components/Switch/Switch.js index 9ca1fc523f4..b2478c58fc1 100644 --- a/packages/react-native/Libraries/Components/Switch/Switch.js +++ b/packages/react-native/Libraries/Components/Switch/Switch.js @@ -15,7 +15,6 @@ import type {AccessibilityState} from '../View/ViewAccessibility'; import type {ViewProps} from '../View/ViewPropTypes'; import StyleSheet from '../../StyleSheet/StyleSheet'; -import Platform from '../../Utilities/Platform'; import useMergeRefs from '../../Utilities/useMergeRefs'; import AndroidSwitchNativeComponent, { Commands as AndroidSwitchCommands, @@ -26,6 +25,8 @@ import SwitchNativeComponent, { import * as React from 'react'; import {useLayoutEffect, useRef, useState} from 'react'; +const Platform = require('../../Utilities/Platform').default; + export type SwitchInstance = HostInstance; export type SwitchPropsIOS = { diff --git a/packages/react-native/Libraries/Components/TextInput/InputAccessoryView.js b/packages/react-native/Libraries/Components/TextInput/InputAccessoryView.js index 0ecc6f77c1c..95f01e0a2d3 100644 --- a/packages/react-native/Libraries/Components/TextInput/InputAccessoryView.js +++ b/packages/react-native/Libraries/Components/TextInput/InputAccessoryView.js @@ -13,11 +13,12 @@ import StyleSheet, { type ColorValue, type ViewStyleProp, } from '../../StyleSheet/StyleSheet'; -import Platform from '../../Utilities/Platform'; import useWindowDimensions from '../../Utilities/useWindowDimensions'; import RCTInputAccessoryViewNativeComponent from './RCTInputAccessoryViewNativeComponent'; import * as React from 'react'; +const Platform = require('../../Utilities/Platform').default; + /** * Note: iOS only * diff --git a/packages/react-native/Libraries/Components/TextInput/TextInput.js b/packages/react-native/Libraries/Components/TextInput/TextInput.js index 0206446c926..3011ea21d55 100644 --- a/packages/react-native/Libraries/Components/TextInput/TextInput.js +++ b/packages/react-native/Libraries/Components/TextInput/TextInput.js @@ -56,7 +56,6 @@ import flattenStyle from '../../StyleSheet/flattenStyle'; import StyleSheet, {type TextStyleProp} from '../../StyleSheet/StyleSheet'; import Text from '../../Text/Text'; import TextAncestorContext from '../../Text/TextAncestorContext'; -import Platform from '../../Utilities/Platform'; import useMergeRefs from '../../Utilities/useMergeRefs'; import TextInputState from './TextInputState'; import invariant from 'invariant'; @@ -64,6 +63,8 @@ import nullthrows from 'nullthrows'; import * as React from 'react'; import {useCallback, useLayoutEffect, useMemo, useRef, useState} from 'react'; +const Platform = require('../../Utilities/Platform').default; + let AndroidTextInput; let AndroidTextInputCommands; let RCTSinglelineTextInputView; diff --git a/packages/react-native/Libraries/Components/Touchable/Touchable.js b/packages/react-native/Libraries/Components/Touchable/Touchable.js index 72c4aef50d6..330a78b7a2c 100644 --- a/packages/react-native/Libraries/Components/Touchable/Touchable.js +++ b/packages/react-native/Libraries/Components/Touchable/Touchable.js @@ -18,12 +18,13 @@ import type { import {PressabilityDebugView} from '../../Pressability/PressabilityDebug'; import UIManager from '../../ReactNative/UIManager'; -import Platform from '../../Utilities/Platform'; import SoundManager from '../Sound/SoundManager'; import BoundingDimensions from './BoundingDimensions'; import Position from './Position'; import * as React from 'react'; +const Platform = require('../../Utilities/Platform').default; + const extractSingleTouch = (nativeEvent: { readonly changedTouches: ReadonlyArray, readonly force?: number, diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableBounce.js b/packages/react-native/Libraries/Components/Touchable/TouchableBounce.js index 3370b442d15..b3c54c53a3a 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableBounce.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableBounce.js @@ -16,9 +16,10 @@ import Pressability, { type PressabilityConfig, } from '../../Pressability/Pressability'; import {PressabilityDebugView} from '../../Pressability/PressabilityDebug'; -import Platform from '../../Utilities/Platform'; import * as React from 'react'; +const Platform = require('../../Utilities/Platform').default; + type TouchableBounceProps = Readonly<{ ...React.ElementConfig, diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js b/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js index 5fe029ae0be..df4c4e2d8c6 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js @@ -19,11 +19,12 @@ import Pressability, { } from '../../Pressability/Pressability'; import {PressabilityDebugView} from '../../Pressability/PressabilityDebug'; import StyleSheet, {type ViewStyleProp} from '../../StyleSheet/StyleSheet'; -import Platform from '../../Utilities/Platform'; import warnOnce from '../../Utilities/warnOnce'; import * as React from 'react'; import {cloneElement} from 'react'; +const Platform = require('../../Utilities/Platform').default; + export type TouchableHighlightInstance = HostInstance; type AndroidProps = Readonly<{ diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableNativeFeedback.js b/packages/react-native/Libraries/Components/Touchable/TouchableNativeFeedback.js index ad3452621c0..01fbdc1d43e 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableNativeFeedback.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableNativeFeedback.js @@ -20,11 +20,12 @@ import Pressability, { import {PressabilityDebugView} from '../../Pressability/PressabilityDebug'; import {findHostInstance_DEPRECATED} from '../../ReactNative/RendererProxy'; import processColor from '../../StyleSheet/processColor'; -import Platform from '../../Utilities/Platform'; import {Commands} from '../View/ViewNativeComponent'; import * as React from 'react'; import {cloneElement} from 'react'; +const Platform = require('../../Utilities/Platform').default; + type TouchableNativeFeedbackTVProps = { /** * *(Apple TV only)* TV preferred focus (see documentation for the View component). diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js b/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js index 1dfdb839348..301dc5c2813 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js @@ -19,9 +19,10 @@ import Pressability, { } from '../../Pressability/Pressability'; import {PressabilityDebugView} from '../../Pressability/PressabilityDebug'; import flattenStyle from '../../StyleSheet/flattenStyle'; -import Platform from '../../Utilities/Platform'; import * as React from 'react'; +const Platform = require('../../Utilities/Platform').default; + export type TouchableOpacityInstance = HostInstance; export type TouchableOpacityTVProps = Readonly<{ diff --git a/packages/react-native/Libraries/Core/ReactNativeVersionCheck.js b/packages/react-native/Libraries/Core/ReactNativeVersionCheck.js index 11668ce6bce..45dea1769c5 100644 --- a/packages/react-native/Libraries/Core/ReactNativeVersionCheck.js +++ b/packages/react-native/Libraries/Core/ReactNativeVersionCheck.js @@ -8,8 +8,7 @@ * @format */ -import Platform from '../Utilities/Platform'; - +const Platform = require('../Utilities/Platform').default; const ReactNativeVersion = require('./ReactNativeVersion'); /** diff --git a/packages/react-native/Libraries/Core/setUpDeveloperTools.js b/packages/react-native/Libraries/Core/setUpDeveloperTools.js index 3b368000348..e930bb12815 100644 --- a/packages/react-native/Libraries/Core/setUpDeveloperTools.js +++ b/packages/react-native/Libraries/Core/setUpDeveloperTools.js @@ -8,7 +8,7 @@ * @format */ -import Platform from '../Utilities/Platform'; +const Platform = require('../Utilities/Platform').default; declare var console: {[string]: $FlowFixMe}; diff --git a/packages/react-native/Libraries/EventEmitter/NativeEventEmitter.js b/packages/react-native/Libraries/EventEmitter/NativeEventEmitter.js index 579a06e6beb..75e7bdfe702 100644 --- a/packages/react-native/Libraries/EventEmitter/NativeEventEmitter.js +++ b/packages/react-native/Libraries/EventEmitter/NativeEventEmitter.js @@ -15,10 +15,11 @@ import type { IEventEmitter, } from '../vendor/emitter/EventEmitter'; -import Platform from '../Utilities/Platform'; import RCTDeviceEventEmitter from './RCTDeviceEventEmitter'; import invariant from 'invariant'; +const Platform = require('../Utilities/Platform').default; + interface NativeModule { addListener(eventType: string): void; removeListeners(count: number): void; diff --git a/packages/react-native/Libraries/Image/ImageViewNativeComponent.js b/packages/react-native/Libraries/Image/ImageViewNativeComponent.js index 94e6970863b..e4d5817f3ef 100644 --- a/packages/react-native/Libraries/Image/ImageViewNativeComponent.js +++ b/packages/react-native/Libraries/Image/ImageViewNativeComponent.js @@ -25,7 +25,8 @@ import {colorAttribute} from '../Components/View/ReactNativeStyleAttributes'; import * as NativeComponentRegistry from '../NativeComponent/NativeComponentRegistry'; import {ConditionallyIgnoredEventHandlers} from '../NativeComponent/ViewConfigIgnore'; import codegenNativeCommands from '../Utilities/codegenNativeCommands'; -import Platform from '../Utilities/Platform'; + +const Platform = require('../Utilities/Platform').default; type ImageHostComponentProps = Readonly<{ ...ImageProps, diff --git a/packages/react-native/Libraries/Image/nativeImageSource.js b/packages/react-native/Libraries/Image/nativeImageSource.js index a7bf9396e05..06e31c98496 100644 --- a/packages/react-native/Libraries/Image/nativeImageSource.js +++ b/packages/react-native/Libraries/Image/nativeImageSource.js @@ -10,7 +10,7 @@ import type {ImageURISource} from './ImageSource'; -import Platform from '../Utilities/Platform'; +const Platform = require('../Utilities/Platform').default; type NativeImageSourceSpec = Readonly<{ android?: string, diff --git a/packages/react-native/Libraries/LayoutAnimation/LayoutAnimation.js b/packages/react-native/Libraries/LayoutAnimation/LayoutAnimation.js index 0541357195d..23151f42b01 100644 --- a/packages/react-native/Libraries/LayoutAnimation/LayoutAnimation.js +++ b/packages/react-native/Libraries/LayoutAnimation/LayoutAnimation.js @@ -18,9 +18,9 @@ import type { import * as ReactNativeFeatureFlags from '../../src/private/featureflags/ReactNativeFeatureFlags'; import {getFabricUIManager} from '../ReactNative/FabricUIManager'; -import Platform from '../Utilities/Platform'; const UIManager = require('../ReactNative/UIManager').default; +const Platform = require('../Utilities/Platform').default; export type { LayoutAnimationType, diff --git a/packages/react-native/Libraries/Linking/Linking.js b/packages/react-native/Libraries/Linking/Linking.js index 605597b115b..a912a61f208 100644 --- a/packages/react-native/Libraries/Linking/Linking.js +++ b/packages/react-native/Libraries/Linking/Linking.js @@ -11,12 +11,13 @@ import type {EventSubscription} from '../vendor/emitter/EventEmitter'; import NativeEventEmitter from '../EventEmitter/NativeEventEmitter'; -import Platform from '../Utilities/Platform'; import NativeIntentAndroid from './NativeIntentAndroid'; import NativeLinkingManager from './NativeLinkingManager'; import invariant from 'invariant'; import nullthrows from 'nullthrows'; +const Platform = require('../Utilities/Platform').default; + type LinkingEventDefinitions = { url: [{url: string}], }; diff --git a/packages/react-native/Libraries/Lists/SectionList.js b/packages/react-native/Libraries/Lists/SectionList.js index 489a5c93236..3c1f606ecd5 100644 --- a/packages/react-native/Libraries/Lists/SectionList.js +++ b/packages/react-native/Libraries/Lists/SectionList.js @@ -19,10 +19,11 @@ import type { VirtualizedSectionListProps, } from '@react-native/virtualized-lists'; -import Platform from '../Utilities/Platform'; import VirtualizedLists from '@react-native/virtualized-lists'; import * as React from 'react'; +const Platform = require('../Utilities/Platform').default; + const VirtualizedSectionList = VirtualizedLists.VirtualizedSectionList; type DefaultSectionT = { diff --git a/packages/react-native/Libraries/Lists/SectionListModern.js b/packages/react-native/Libraries/Lists/SectionListModern.js index 2661a31bc32..5ff6931f302 100644 --- a/packages/react-native/Libraries/Lists/SectionListModern.js +++ b/packages/react-native/Libraries/Lists/SectionListModern.js @@ -18,11 +18,12 @@ import type { VirtualizedSectionListProps, } from '@react-native/virtualized-lists'; -import Platform from '../Utilities/Platform'; import VirtualizedLists from '@react-native/virtualized-lists'; import * as React from 'react'; import {useImperativeHandle, useRef} from 'react'; +const Platform = require('../Utilities/Platform').default; + const VirtualizedSectionList = VirtualizedLists.VirtualizedSectionList; type DefaultSectionT = { diff --git a/packages/react-native/Libraries/LogBox/LogBox.js b/packages/react-native/Libraries/LogBox/LogBox.js index 591786f7d78..19f7eb7622a 100644 --- a/packages/react-native/Libraries/LogBox/LogBox.js +++ b/packages/react-native/Libraries/LogBox/LogBox.js @@ -13,10 +13,11 @@ import type {Stack} from './Data/LogBoxSymbolication'; import type {ExtendedExceptionData} from './Data/parseLogBoxLog'; import toExtendedError from '../../src/private/utilities/toExtendedError'; -import Platform from '../Utilities/Platform'; import RCTLog from '../Utilities/RCTLog'; import * as React from 'react'; +const Platform = require('../Utilities/Platform').default; + // TODO: Remove support for LegacyComponentStackFrame in a future version. // This is kept for backward compatibility with external callers of LogBox.addLog. function convertLegacyComponentStack(componentStack: Stack): Stack { diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js index 8611a6d8d26..cd3202a219d 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js @@ -15,7 +15,6 @@ import View from '../../Components/View/View'; import openFileInEditor from '../../Core/Devtools/openFileInEditor'; import StyleSheet from '../../StyleSheet/StyleSheet'; import Text from '../../Text/Text'; -import Platform from '../../Utilities/Platform'; import * as LogBoxData from '../Data/LogBoxData'; import AnsiHighlight from './AnsiHighlight'; import LogBoxButton from './LogBoxButton'; @@ -23,6 +22,8 @@ import LogBoxInspectorSection from './LogBoxInspectorSection'; import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; +const Platform = require('../../Utilities/Platform').default; + component CodeFrameDisplay(codeFrame: CodeFrame) { function getFileName() { // $FlowFixMe[incompatible-use] diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorHeader.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorHeader.js index 653a67a5a34..19478c3cb71 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorHeader.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorHeader.js @@ -15,11 +15,12 @@ import SafeAreaView from '../../Components/SafeAreaView/SafeAreaView'; import View from '../../Components/View/View'; import StyleSheet from '../../StyleSheet/StyleSheet'; import Text from '../../Text/Text'; -import Platform from '../../Utilities/Platform'; import LogBoxInspectorHeaderButton from './LogBoxInspectorHeaderButton'; import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; +const Platform = require('../../Utilities/Platform').default; + type Props = Readonly<{ onSelectIndex: (selectedIndex: number) => void, selectedIndex: number, diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js index d583068b45a..d5c3066faa8 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js @@ -14,13 +14,14 @@ import View from '../../Components/View/View'; import openFileInEditor from '../../Core/Devtools/openFileInEditor'; import StyleSheet from '../../StyleSheet/StyleSheet'; import Text from '../../Text/Text'; -import Platform from '../../Utilities/Platform'; import LogBoxButton from './LogBoxButton'; import LogBoxInspectorSection from './LogBoxInspectorSection'; import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; import {useState} from 'react'; +const Platform = require('../../Utilities/Platform').default; + const BEFORE_SLASH_RE = /^(.*)[\\/]/; // Taken from React https://github.com/facebook/react/blob/206d61f72214e8ae5b935f0bf8628491cb7f0797/packages/react-devtools-shared/src/backend/describeComponentFrame.js#L27-L41 diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js index d33b7bf8ca5..5552856a794 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js @@ -14,11 +14,12 @@ import type {GestureResponderEvent} from '../../Types/CoreEventTypes'; import View from '../../Components/View/View'; import StyleSheet from '../../StyleSheet/StyleSheet'; import Text from '../../Text/Text'; -import Platform from '../../Utilities/Platform'; import LogBoxButton from './LogBoxButton'; import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; +const Platform = require('../../Utilities/Platform').default; + const noop = () => {}; component LogBoxInspectorStackFrame( diff --git a/packages/react-native/Libraries/NativeComponent/ViewConfigIgnore.js b/packages/react-native/Libraries/NativeComponent/ViewConfigIgnore.js index 487913175e4..3ab0a3ce2a2 100644 --- a/packages/react-native/Libraries/NativeComponent/ViewConfigIgnore.js +++ b/packages/react-native/Libraries/NativeComponent/ViewConfigIgnore.js @@ -8,7 +8,7 @@ * @format */ -import Platform from '../Utilities/Platform'; +const Platform = require('../Utilities/Platform').default; const ignoredViewConfigProps = new WeakSet<{...}>(); diff --git a/packages/react-native/Libraries/Network/RCTNetworking.android.js b/packages/react-native/Libraries/Network/RCTNetworking.android.js index c79b584a4d3..5d545b12ea9 100644 --- a/packages/react-native/Libraries/Network/RCTNetworking.android.js +++ b/packages/react-native/Libraries/Network/RCTNetworking.android.js @@ -16,10 +16,11 @@ import type {NativeResponseType} from './XMLHttpRequest'; // Do not require the native RCTNetworking module directly! Use this wrapper module instead. // It will add the necessary requestId, so that you don't have to generate it yourself. import NativeEventEmitter from '../EventEmitter/NativeEventEmitter'; -import Platform from '../Utilities/Platform'; import convertRequestBody from './convertRequestBody'; import NativeNetworkingAndroid from './NativeNetworkingAndroid'; +const Platform = require('../Utilities/Platform').default; + type Header = [string, string]; // Convert FormData headers to arrays, which are easier to consume in diff --git a/packages/react-native/Libraries/Pressability/HoverState.js b/packages/react-native/Libraries/Pressability/HoverState.js index cfa3f2fd59a..a3fb977462e 100644 --- a/packages/react-native/Libraries/Pressability/HoverState.js +++ b/packages/react-native/Libraries/Pressability/HoverState.js @@ -8,7 +8,7 @@ * @format */ -import Platform from '../Utilities/Platform'; +const Platform = require('../Utilities/Platform').default; let isEnabled = false; diff --git a/packages/react-native/Libraries/Pressability/Pressability.js b/packages/react-native/Libraries/Pressability/Pressability.js index 0be465bec54..4683422155e 100644 --- a/packages/react-native/Libraries/Pressability/Pressability.js +++ b/packages/react-native/Libraries/Pressability/Pressability.js @@ -21,12 +21,13 @@ import SoundManager from '../Components/Sound/SoundManager'; import UIManager from '../ReactNative/UIManager'; import {type RectOrSize, normalizeRect} from '../StyleSheet/Rect'; import {type PointerEvent} from '../Types/CoreEventTypes'; -import Platform from '../Utilities/Platform'; import {isHoverEnabled} from './HoverState'; import PressabilityPerformanceEventEmitter from './PressabilityPerformanceEventEmitter.js'; import {type PressabilityTouchSignal as TouchSignal} from './PressabilityTypes.js'; import invariant from 'invariant'; +const Platform = require('../Utilities/Platform').default; + export type PressabilityConfig = Readonly<{ /** * Whether a press gesture can be interrupted by a parent gesture such as a diff --git a/packages/react-native/Libraries/PushNotificationIOS/PushNotificationIOS.js b/packages/react-native/Libraries/PushNotificationIOS/PushNotificationIOS.js index ddc0389e0b7..69376115ad9 100644 --- a/packages/react-native/Libraries/PushNotificationIOS/PushNotificationIOS.js +++ b/packages/react-native/Libraries/PushNotificationIOS/PushNotificationIOS.js @@ -11,10 +11,11 @@ import type {EventSubscription} from '../vendor/emitter/EventEmitter'; import NativeEventEmitter from '../EventEmitter/NativeEventEmitter'; -import Platform from '../Utilities/Platform'; import NativePushNotificationManagerIOS from './NativePushNotificationManagerIOS'; import invariant from 'invariant'; +const Platform = require('../Utilities/Platform').default; + export type PushNotificationPermissions = { alert: boolean, badge: boolean, diff --git a/packages/react-native/Libraries/ReactNative/BridgelessUIManager.js b/packages/react-native/Libraries/ReactNative/BridgelessUIManager.js index 0db6d341549..d0c39c3eefb 100644 --- a/packages/react-native/Libraries/ReactNative/BridgelessUIManager.js +++ b/packages/react-native/Libraries/ReactNative/BridgelessUIManager.js @@ -15,10 +15,11 @@ import type {UIManagerJSInterface} from '../Types/UIManagerJSInterface'; import {unstable_hasComponent} from '../NativeComponent/NativeComponentRegistryUnstable'; import defineLazyObjectProperty from '../Utilities/defineLazyObjectProperty'; -import Platform from '../Utilities/Platform'; import {getFabricUIManager} from './FabricUIManager'; import nullthrows from 'nullthrows'; +const Platform = require('../Utilities/Platform').default; + function raiseSoftError(methodName: string, details?: string): void { console.error( `[ReactNative Architecture][JS] '${methodName}' is not available in the new React Native architecture.` + diff --git a/packages/react-native/Libraries/Settings/Settings.js b/packages/react-native/Libraries/Settings/Settings.js index b0ec5480569..8d7d501ad22 100644 --- a/packages/react-native/Libraries/Settings/Settings.js +++ b/packages/react-native/Libraries/Settings/Settings.js @@ -8,7 +8,7 @@ * @format */ -import Platform from '../Utilities/Platform'; +const Platform = require('../Utilities/Platform').default; let Settings: { get(key: string): any, diff --git a/packages/react-native/Libraries/Text/Text.js b/packages/react-native/Libraries/Text/Text.js index 8efa7be273f..6e0b12bb12d 100644 --- a/packages/react-native/Libraries/Text/Text.js +++ b/packages/react-native/Libraries/Text/Text.js @@ -21,7 +21,6 @@ import usePressability from '../Pressability/usePressability'; import flattenStyle from '../StyleSheet/flattenStyle'; import processColor from '../StyleSheet/processColor'; import StyleSheet from '../StyleSheet/StyleSheet'; -import Platform from '../Utilities/Platform'; import TextAncestorContext from './TextAncestorContext'; import { NativeSelectableText, @@ -31,6 +30,8 @@ import { import * as React from 'react'; import {useContext, useMemo, useState} from 'react'; +const Platform = require('../Utilities/Platform').default; + export type TextInstance = HostInstance; export type {TextProps} from './TextProps'; diff --git a/packages/react-native/Libraries/Utilities/DevSettings.js b/packages/react-native/Libraries/Utilities/DevSettings.js index 8b7494264df..b0b0356c6f1 100644 --- a/packages/react-native/Libraries/Utilities/DevSettings.js +++ b/packages/react-native/Libraries/Utilities/DevSettings.js @@ -12,7 +12,8 @@ import type {EventSubscription} from '../vendor/emitter/EventEmitter'; import NativeEventEmitter from '../EventEmitter/NativeEventEmitter'; import NativeDevSettings from '../NativeModules/specs/NativeDevSettings'; -import Platform from '../Utilities/Platform'; + +const Platform = require('../Utilities/Platform').default; /** * The DevSettings module exposes methods for customizing settings for developers in development. diff --git a/packages/react-native/Libraries/WebSocket/WebSocket.js b/packages/react-native/Libraries/WebSocket/WebSocket.js index 36aafbbbab1..3818271c842 100644 --- a/packages/react-native/Libraries/WebSocket/WebSocket.js +++ b/packages/react-native/Libraries/WebSocket/WebSocket.js @@ -24,11 +24,12 @@ import Blob from '../Blob/Blob'; import BlobManager from '../Blob/BlobManager'; import NativeEventEmitter from '../EventEmitter/NativeEventEmitter'; import binaryToBase64 from '../Utilities/binaryToBase64'; -import Platform from '../Utilities/Platform'; import NativeWebSocketModule from './NativeWebSocketModule'; import base64 from 'base64-js'; import invariant from 'invariant'; +const Platform = require('../Utilities/Platform').default; + type ArrayBufferView = | Int8Array | Uint8Array diff --git a/packages/react-native/Libraries/WebSocket/WebSocketInterceptor.js b/packages/react-native/Libraries/WebSocket/WebSocketInterceptor.js index 9d051902d06..b5ba8a0f4b8 100644 --- a/packages/react-native/Libraries/WebSocket/WebSocketInterceptor.js +++ b/packages/react-native/Libraries/WebSocket/WebSocketInterceptor.js @@ -9,10 +9,11 @@ */ import NativeEventEmitter from '../EventEmitter/NativeEventEmitter'; -import Platform from '../Utilities/Platform'; import NativeWebSocketModule from './NativeWebSocketModule'; import base64 from 'base64-js'; +const Platform = require('../Utilities/Platform').default; + const originalRCTWebSocketConnect = NativeWebSocketModule.connect; const originalRCTWebSocketSend = NativeWebSocketModule.send; const originalRCTWebSocketSendBinary = NativeWebSocketModule.sendBinary; diff --git a/packages/react-native/src/private/animated/NativeAnimatedHelper.js b/packages/react-native/src/private/animated/NativeAnimatedHelper.js index f27650b3d32..87047d1bafe 100644 --- a/packages/react-native/src/private/animated/NativeAnimatedHelper.js +++ b/packages/react-native/src/private/animated/NativeAnimatedHelper.js @@ -25,11 +25,12 @@ import NativeAnimatedNonTurboModule from '../../../Libraries/Animated/NativeAnim import NativeAnimatedTurboModule from '../../../Libraries/Animated/NativeAnimatedTurboModule'; import NativeEventEmitter from '../../../Libraries/EventEmitter/NativeEventEmitter'; import RCTDeviceEventEmitter from '../../../Libraries/EventEmitter/RCTDeviceEventEmitter'; -import Platform from '../../../Libraries/Utilities/Platform'; import * as ReactNativeFeatureFlags from '../featureflags/ReactNativeFeatureFlags'; import invariant from 'invariant'; import nullthrows from 'nullthrows'; +const Platform = require('../../../Libraries/Utilities/Platform').default; + interface NativeAnimatedModuleSpec extends NativeAnimatedTurboModuleSpec { // connectAnimatedNodeToShadowNodeFamily is available only in NativeAnimatedNonTurboModule readonly connectAnimatedNodeToShadowNodeFamily?: ( diff --git a/packages/react-native/src/private/components/safeareaview/SafeAreaView_INTERNAL_DO_NOT_USE.js b/packages/react-native/src/private/components/safeareaview/SafeAreaView_INTERNAL_DO_NOT_USE.js index 3bb3530a161..11c9dfa5981 100644 --- a/packages/react-native/src/private/components/safeareaview/SafeAreaView_INTERNAL_DO_NOT_USE.js +++ b/packages/react-native/src/private/components/safeareaview/SafeAreaView_INTERNAL_DO_NOT_USE.js @@ -12,9 +12,10 @@ import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropType import View from '../../../../Libraries/Components/View/View'; import UIManager from '../../../../Libraries/ReactNative/UIManager'; -import Platform from '../../../../Libraries/Utilities/Platform'; import * as React from 'react'; +const Platform = require('../../../../Libraries/Utilities/Platform').default; + const exported: component( ref?: React.RefSetter>, ...ViewProps diff --git a/packages/react-native/src/private/components/scrollview/HScrollViewNativeComponents.js b/packages/react-native/src/private/components/scrollview/HScrollViewNativeComponents.js index da05855fa06..a1b3fe6ef4a 100644 --- a/packages/react-native/src/private/components/scrollview/HScrollViewNativeComponents.js +++ b/packages/react-native/src/private/components/scrollview/HScrollViewNativeComponents.js @@ -15,9 +15,10 @@ import type {HostComponent} from '../../types/HostComponent'; import AndroidHorizontalScrollViewNativeComponent from '../../../../Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent'; import ScrollContentViewNativeComponent from '../../../../Libraries/Components/ScrollView/ScrollContentViewNativeComponent'; import ScrollViewNativeComponent from '../../../../Libraries/Components/ScrollView/ScrollViewNativeComponent'; -import Platform from '../../../../Libraries/Utilities/Platform'; import AndroidHorizontalScrollContentViewNativeComponent from '../../specs_DEPRECATED/components/AndroidHorizontalScrollContentViewNativeComponent'; +const Platform = require('../../../../Libraries/Utilities/Platform').default; + export const HScrollViewNativeComponent: HostComponent = Platform.OS === 'android' ? AndroidHorizontalScrollViewNativeComponent diff --git a/packages/react-native/src/private/components/scrollview/VScrollViewNativeComponents.js b/packages/react-native/src/private/components/scrollview/VScrollViewNativeComponents.js index 67e12fe7904..cff1274ac8c 100644 --- a/packages/react-native/src/private/components/scrollview/VScrollViewNativeComponents.js +++ b/packages/react-native/src/private/components/scrollview/VScrollViewNativeComponents.js @@ -15,7 +15,8 @@ import type {HostComponent} from '../../types/HostComponent'; import ScrollContentViewNativeComponent from '../../../../Libraries/Components/ScrollView/ScrollContentViewNativeComponent'; import ScrollViewNativeComponent from '../../../../Libraries/Components/ScrollView/ScrollViewNativeComponent'; import View from '../../../../Libraries/Components/View/View'; -import Platform from '../../../../Libraries/Utilities/Platform'; + +const Platform = require('../../../../Libraries/Utilities/Platform').default; export const VScrollViewNativeComponent: HostComponent = ScrollViewNativeComponent;