diff --git a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/ArrayPropsNativeComponent.js b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/ArrayPropsNativeComponent.js index 3b7df87e72d..521b9aeff4d 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/ArrayPropsNativeComponent.js +++ b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/ArrayPropsNativeComponent.js @@ -8,23 +8,18 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type {ImageSource} from 'react-native/Libraries/Image/ImageSource'; -import type {ColorValue} from 'react-native/Libraries/StyleSheet/StyleSheet'; import type { + CodegenTypes, + ColorValue, DimensionValue, EdgeInsetsValue, + HostComponent, + ImageSource, PointValue, -} from 'react-native/Libraries/StyleSheet/StyleSheetTypes'; -import type { - Float, - Int32, - UnsafeMixed, - WithDefault, -} from 'react-native/Libraries/Types/CodegenTypes'; + ViewProps, +} from 'react-native'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeComponent} from 'react-native'; type NativeProps = Readonly<{ ...ViewProps, @@ -32,17 +27,19 @@ type NativeProps = Readonly<{ // Props names?: ReadonlyArray, disableds?: ReadonlyArray, - progress?: ReadonlyArray, - radii?: ReadonlyArray, + progress?: ReadonlyArray, + radii?: ReadonlyArray, colors?: ReadonlyArray, srcs?: ReadonlyArray, points?: ReadonlyArray, edgeInsets?: ReadonlyArray, dimensions?: ReadonlyArray, - sizes?: WithDefault, 'small'>, + sizes?: CodegenTypes.WithDefault, 'small'>, object?: ReadonlyArray>, - arrayOfObjects?: ReadonlyArray>, - arrayOfMixed?: ReadonlyArray, + arrayOfObjects?: ReadonlyArray< + Readonly<{prop1: CodegenTypes.Float, prop2: CodegenTypes.Int32}>, + >, + arrayOfMixed?: ReadonlyArray, }>; export default codegenNativeComponent( diff --git a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/BooleanPropNativeComponent.js b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/BooleanPropNativeComponent.js index 39e4648f55b..7f730506f63 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/BooleanPropNativeComponent.js +++ b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/BooleanPropNativeComponent.js @@ -8,18 +8,16 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type {WithDefault} from 'react-native/Libraries/Types/CodegenTypes'; +import type {CodegenTypes, HostComponent, ViewProps} from 'react-native'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeComponent} from 'react-native'; type NativeProps = Readonly<{ ...ViewProps, // Props - disabled?: WithDefault, - disabledNullable?: WithDefault, + disabled?: CodegenTypes.WithDefault, + disabledNullable?: CodegenTypes.WithDefault, }>; export default codegenNativeComponent( diff --git a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/ColorPropNativeComponent.js b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/ColorPropNativeComponent.js index 0732fdbd576..70292fd2c89 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/ColorPropNativeComponent.js +++ b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/ColorPropNativeComponent.js @@ -8,11 +8,9 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type {ColorValue} from 'react-native/Libraries/StyleSheet/StyleSheet'; +import type {ColorValue, HostComponent, ViewProps} from 'react-native'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeComponent} from 'react-native'; type NativeProps = Readonly<{ ...ViewProps, diff --git a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/DimensionPropNativeComponent.js b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/DimensionPropNativeComponent.js index 6edb39355c5..22504df33f6 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/DimensionPropNativeComponent.js +++ b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/DimensionPropNativeComponent.js @@ -8,11 +8,9 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type {DimensionValue} from 'react-native/Libraries/StyleSheet/StyleSheetTypes'; +import type {DimensionValue, HostComponent, ViewProps} from 'react-native'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeComponent} from 'react-native'; type NativeProps = Readonly<{ ...ViewProps, diff --git a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/EdgeInsetsPropNativeComponent.js b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/EdgeInsetsPropNativeComponent.js index 87c1e1a0013..c380bf52e95 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/EdgeInsetsPropNativeComponent.js +++ b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/EdgeInsetsPropNativeComponent.js @@ -8,10 +8,9 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; +import type {HostComponent, ViewProps} from 'react-native'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeComponent} from 'react-native'; type NativeProps = Readonly<{ ...ViewProps, diff --git a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/EnumPropNativeComponent.js b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/EnumPropNativeComponent.js index 42d76a74139..66d2ea65ac2 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/EnumPropNativeComponent.js +++ b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/EnumPropNativeComponent.js @@ -8,18 +8,19 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type {WithDefault} from 'react-native/Libraries/Types/CodegenTypes'; +import type {CodegenTypes, HostComponent, ViewProps} from 'react-native'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeComponent} from 'react-native'; type NativeProps = Readonly<{ ...ViewProps, // Props - alignment?: WithDefault<'top' | 'center' | 'bottom-right', 'center'>, - intervals?: WithDefault<0 | 15 | 30 | 60, 0>, + alignment?: CodegenTypes.WithDefault< + 'top' | 'center' | 'bottom-right', + 'center', + >, + intervals?: CodegenTypes.WithDefault<0 | 15 | 30 | 60, 0>, }>; export default codegenNativeComponent( diff --git a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/EventNestedObjectPropsNativeComponent.js b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/EventNestedObjectPropsNativeComponent.js index 1f43ca3c779..a775e4af6c7 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/EventNestedObjectPropsNativeComponent.js +++ b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/EventNestedObjectPropsNativeComponent.js @@ -8,21 +8,15 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type { - BubblingEventHandler, - Int32, - WithDefault, -} from 'react-native/Libraries/Types/CodegenTypes'; +import type {CodegenTypes, HostComponent, ViewProps} from 'react-native'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeComponent} from 'react-native'; type OnChangeEvent = Readonly<{ location: { source: {url: string, ...}, - x: Int32, - y: Int32, + x: CodegenTypes.Int32, + y: CodegenTypes.Int32, arrayOfObjects: ReadonlyArray<{value: Readonly<{str: string}>}>, ... }, @@ -32,10 +26,10 @@ type NativeProps = Readonly<{ ...ViewProps, // Props - disabled?: WithDefault, + disabled?: CodegenTypes.WithDefault, // Events - onChange?: ?BubblingEventHandler, + onChange?: ?CodegenTypes.BubblingEventHandler, }>; export default codegenNativeComponent( diff --git a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/EventPropsNativeComponent.js b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/EventPropsNativeComponent.js index 3350d819c05..e124267ea74 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/EventPropsNativeComponent.js +++ b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/EventPropsNativeComponent.js @@ -8,23 +8,15 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type { - BubblingEventHandler, - DirectEventHandler, - Float, - Int32, - WithDefault, -} from 'react-native/Libraries/Types/CodegenTypes'; +import type {CodegenTypes, HostComponent, ViewProps} from 'react-native'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeComponent} from 'react-native'; type OnChangeEvent = Readonly<{ value: boolean, source?: string, - progress: ?Int32, - scale?: ?Float, + progress: ?CodegenTypes.Int32, + scale?: ?CodegenTypes.Float, }>; type OnEventDirect = Readonly<{ @@ -39,21 +31,24 @@ type NativeProps = Readonly<{ ...ViewProps, // Props - disabled?: WithDefault, + disabled?: CodegenTypes.WithDefault, // Events - onChange?: ?BubblingEventHandler, - onEventDirect?: ?DirectEventHandler, - onEventDirectWithPaperName?: ?DirectEventHandler< + onChange?: ?CodegenTypes.BubblingEventHandler< + OnChangeEvent, + 'paperDirectName', + >, + onEventDirect?: ?CodegenTypes.DirectEventHandler, + onEventDirectWithPaperName?: ?CodegenTypes.DirectEventHandler< OnEventDirect, 'paperDirectName', >, - onOrientationChange?: ?DirectEventHandler< + onOrientationChange?: ?CodegenTypes.DirectEventHandler< OnOrientationChangeEvent, 'paperBubblingName', >, - onEnd?: ?BubblingEventHandler, - onEventBubblingWithPaperName?: ?BubblingEventHandler< + onEnd?: ?CodegenTypes.BubblingEventHandler, + onEventBubblingWithPaperName?: ?CodegenTypes.BubblingEventHandler< null, 'paperBubblingName', >, diff --git a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/FloatPropsNativeComponent.js b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/FloatPropsNativeComponent.js index 958aecca7fd..062d3daa3d5 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/FloatPropsNativeComponent.js +++ b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/FloatPropsNativeComponent.js @@ -8,26 +8,21 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type { - Float, - WithDefault, -} from 'react-native/Libraries/Types/CodegenTypes'; +import type {CodegenTypes, HostComponent, ViewProps} from 'react-native'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeComponent} from 'react-native'; type NativeProps = Readonly<{ ...ViewProps, // Props - blurRadius: Float, - blurRadius2?: WithDefault, - blurRadius3?: WithDefault, - blurRadius4?: WithDefault, - blurRadius5?: WithDefault, - blurRadius6?: WithDefault, - blurRadiusNullable?: WithDefault, + blurRadius: CodegenTypes.Float, + blurRadius2?: CodegenTypes.WithDefault, + blurRadius3?: CodegenTypes.WithDefault, + blurRadius4?: CodegenTypes.WithDefault, + blurRadius5?: CodegenTypes.WithDefault, + blurRadius6?: CodegenTypes.WithDefault, + blurRadiusNullable?: CodegenTypes.WithDefault, }>; export default codegenNativeComponent( diff --git a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/ImagePropNativeComponent.js b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/ImagePropNativeComponent.js index b29676b272b..6c55a8f2f53 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/ImagePropNativeComponent.js +++ b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/ImagePropNativeComponent.js @@ -8,11 +8,9 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type {ImageSource} from 'react-native/Libraries/Image/ImageSource'; +import type {HostComponent, ImageSource, ViewProps} from 'react-native'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeComponent} from 'react-native'; type NativeProps = Readonly<{ ...ViewProps, diff --git a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/IntegerPropNativeComponent.js b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/IntegerPropNativeComponent.js index 92ddaa623ce..bc02ee4abad 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/IntegerPropNativeComponent.js +++ b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/IntegerPropNativeComponent.js @@ -8,22 +8,17 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type { - Int32, - WithDefault, -} from 'react-native/Libraries/Types/CodegenTypes'; +import type {CodegenTypes, HostComponent, ViewProps} from 'react-native'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeComponent} from 'react-native'; type NativeProps = Readonly<{ ...ViewProps, // Props - progress1?: WithDefault, - progress2?: WithDefault, - progress3?: WithDefault, + progress1?: CodegenTypes.WithDefault, + progress2?: CodegenTypes.WithDefault, + progress3?: CodegenTypes.WithDefault, }>; export default codegenNativeComponent( diff --git a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/InterfaceOnlyNativeComponent.js b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/InterfaceOnlyNativeComponent.js index 98b2efc348e..a3e476e4fa2 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/InterfaceOnlyNativeComponent.js +++ b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/InterfaceOnlyNativeComponent.js @@ -8,23 +8,18 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type { - BubblingEventHandler, - WithDefault, -} from 'react-native/Libraries/Types/CodegenTypes'; +import type {CodegenTypes, HostComponent, ViewProps} from 'react-native'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeComponent} from 'react-native'; type NativeProps = Readonly<{ ...ViewProps, // Props - title?: WithDefault, + title?: CodegenTypes.WithDefault, // Events - onChange?: ?BubblingEventHandler>, + onChange?: ?CodegenTypes.BubblingEventHandler>, }>; export default codegenNativeComponent( diff --git a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/MixedPropNativeComponent.js b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/MixedPropNativeComponent.js index f0b5194c978..f58079be7d2 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/MixedPropNativeComponent.js +++ b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/MixedPropNativeComponent.js @@ -8,17 +8,15 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type {UnsafeMixed} from 'react-native/Libraries/Types/CodegenTypes'; +import type {CodegenTypes, HostComponent, ViewProps} from 'react-native'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeComponent} from 'react-native'; type NativeProps = Readonly<{ ...ViewProps, // Props - mixedProp?: UnsafeMixed, + mixedProp?: CodegenTypes.UnsafeMixed, }>; export default codegenNativeComponent( diff --git a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/MultiNativePropNativeComponent.js b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/MultiNativePropNativeComponent.js index 15ce74eef88..18e9b7eb656 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/MultiNativePropNativeComponent.js +++ b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/MultiNativePropNativeComponent.js @@ -8,13 +8,15 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type {ImageSource} from 'react-native/Libraries/Image/ImageSource'; -import type {ColorValue} from 'react-native/Libraries/StyleSheet/StyleSheet'; -import type {PointValue} from 'react-native/Libraries/StyleSheet/StyleSheetTypes'; +import type { + ColorValue, + HostComponent, + ImageSource, + PointValue, + ViewProps, +} from 'react-native'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeComponent} from 'react-native'; type NativeProps = Readonly<{ ...ViewProps, diff --git a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/NoPropsNoEventsNativeComponent.js b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/NoPropsNoEventsNativeComponent.js index 60de795f289..80ba9e54c55 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/NoPropsNoEventsNativeComponent.js +++ b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/NoPropsNoEventsNativeComponent.js @@ -8,10 +8,9 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; +import type {HostComponent, ViewProps} from 'react-native'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeComponent} from 'react-native'; type NativeProps = Readonly<{ ...ViewProps, diff --git a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/ObjectPropsNativeComponent.js b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/ObjectPropsNativeComponent.js index 619c724c6d7..67f954ae9a5 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/ObjectPropsNativeComponent.js +++ b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/ObjectPropsNativeComponent.js @@ -8,18 +8,16 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type {ImageSource} from 'react-native/Libraries/Image/ImageSource'; -import type {ColorValue} from 'react-native/Libraries/StyleSheet/StyleSheet'; -import type {PointValue} from 'react-native/Libraries/StyleSheet/StyleSheetTypes'; import type { - Float, - Int32, - WithDefault, -} from 'react-native/Libraries/Types/CodegenTypes'; + CodegenTypes, + ColorValue, + HostComponent, + ImageSource, + PointValue, + ViewProps, +} from 'react-native'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeComponent} from 'react-native'; type ObjectArrayPropType = Readonly<{ array: ReadonlyArray, @@ -30,12 +28,12 @@ type NativeProps = Readonly<{ // Props objectProp?: Readonly<{ - stringProp?: WithDefault, + stringProp?: CodegenTypes.WithDefault, booleanProp: boolean, - floatProp: Float, - intProp: Int32, - stringEnumProp?: WithDefault<'small' | 'large', 'small'>, - intEnumProp?: WithDefault<0 | 1, 0>, + floatProp: CodegenTypes.Float, + intProp: CodegenTypes.Int32, + stringEnumProp?: CodegenTypes.WithDefault<'small' | 'large', 'small'>, + intEnumProp?: CodegenTypes.WithDefault<0 | 1, 0>, }>, objectArrayProp: ObjectArrayPropType, objectPrimitiveRequiredProp: Readonly<{ diff --git a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/PointPropNativeComponent.js b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/PointPropNativeComponent.js index 364e73cd548..8590f90f61e 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/PointPropNativeComponent.js +++ b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/PointPropNativeComponent.js @@ -8,11 +8,9 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type {PointValue} from 'react-native/Libraries/StyleSheet/StyleSheetTypes'; +import type {HostComponent, PointValue, ViewProps} from 'react-native'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeComponent} from 'react-native'; type NativeProps = Readonly<{ ...ViewProps, diff --git a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/StringPropNativeComponent.js b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/StringPropNativeComponent.js index 43dad5fd500..32a525f6881 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/StringPropNativeComponent.js +++ b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/StringPropNativeComponent.js @@ -8,17 +8,15 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type {WithDefault} from 'react-native/Libraries/Types/CodegenTypes'; +import type {CodegenTypes, HostComponent, ViewProps} from 'react-native'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeComponent} from 'react-native'; type NativeProps = Readonly<{ ...ViewProps, // Props - placeholder?: WithDefault, + placeholder?: CodegenTypes.WithDefault, defaultValue?: string, }>; diff --git a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeArrayTurboModule.js b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeArrayTurboModule.js index 71da1584be8..e742b6b6247 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeArrayTurboModule.js +++ b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeArrayTurboModule.js @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; export type ArrayType = string; type AnotherArray = Array; diff --git a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeBooleanTurboModule.js b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeBooleanTurboModule.js index af8166072de..960ad4689e5 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeBooleanTurboModule.js +++ b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeBooleanTurboModule.js @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; export type Boolean = boolean; type AnotherBoolean = Boolean; diff --git a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeCallbackTurboModule.js b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeCallbackTurboModule.js index 745966dca77..65f99233567 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeCallbackTurboModule.js +++ b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeCallbackTurboModule.js @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; export type String = string; type CB = (value: String) => void; diff --git a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeEnumTurboModule.js b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeEnumTurboModule.js index bd737086423..b95ee985bd9 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeEnumTurboModule.js +++ b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeEnumTurboModule.js @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; export type StateType = { state: string, diff --git a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeNullableTurboModule.js b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeNullableTurboModule.js index d586369ad55..4f50d61bc2c 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeNullableTurboModule.js +++ b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeNullableTurboModule.js @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { readonly getBool: (a: ?boolean) => ?boolean; diff --git a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeNumberTurboModule.js b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeNumberTurboModule.js index 9754aa73bdd..4c9fdfb1aab 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeNumberTurboModule.js +++ b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeNumberTurboModule.js @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; export type Number = number; type AnotherNumber = Number; diff --git a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeObjectTurboModule.js b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeObjectTurboModule.js index 39b171ee3d3..bfde67006fa 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeObjectTurboModule.js +++ b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeObjectTurboModule.js @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; export type GenericObject = Object; type AnotherGenericObject = GenericObject; diff --git a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeOptionalObjectTurboModule.js b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeOptionalObjectTurboModule.js index a8c4dd18c4d..b5acaf2f05d 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeOptionalObjectTurboModule.js +++ b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeOptionalObjectTurboModule.js @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { readonly getConstants: () => { diff --git a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativePartialAnnotationTurboModule.js b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativePartialAnnotationTurboModule.js index 7e8718733ba..3fc7b5ef602 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativePartialAnnotationTurboModule.js +++ b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativePartialAnnotationTurboModule.js @@ -10,9 +10,9 @@ 'use strict'; -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; export type SomeObj = { a: string, diff --git a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativePromiseTurboModule.js b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativePromiseTurboModule.js index 9eaeb0f2f82..5851aa024c3 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativePromiseTurboModule.js +++ b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativePromiseTurboModule.js @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; export type String = string; type AnotherPromise = Promise; diff --git a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeSampleTurboModule.js b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeSampleTurboModule.js index a1f7c0b1fd7..b4222ddf876 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeSampleTurboModule.js +++ b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeSampleTurboModule.js @@ -8,12 +8,9 @@ * @format */ -import type { - RootTag, - TurboModule, -} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {RootTag, TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; type Animal = { name: string, diff --git a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeSampleTurboModuleArrays.js b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeSampleTurboModuleArrays.js index 790a5a4861e..643233fecb9 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeSampleTurboModuleArrays.js +++ b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeSampleTurboModuleArrays.js @@ -8,12 +8,9 @@ * @format */ -import type { - RootTag, - TurboModule, -} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {RootTag, TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; type Animal = { name: string, diff --git a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeSampleTurboModuleNullable.js b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeSampleTurboModuleNullable.js index d635d0d23e6..f7e5a1c7700 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeSampleTurboModuleNullable.js +++ b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeSampleTurboModuleNullable.js @@ -8,12 +8,9 @@ * @format */ -import type { - RootTag, - TurboModule, -} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {RootTag, TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; type Animal = ?{ name: ?string, diff --git a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeSampleTurboModuleNullableAndOptional.js b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeSampleTurboModuleNullableAndOptional.js index b9fb069bca0..e36c49845ca 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeSampleTurboModuleNullableAndOptional.js +++ b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeSampleTurboModuleNullableAndOptional.js @@ -8,12 +8,9 @@ * @format */ -import type { - RootTag, - TurboModule, -} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {RootTag, TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; type Animal = ?{ name?: ?string, diff --git a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeSampleTurboModuleOptional.js b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeSampleTurboModuleOptional.js index c5aa1d50eb8..6b2bd4ea501 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeSampleTurboModuleOptional.js +++ b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeSampleTurboModuleOptional.js @@ -8,12 +8,9 @@ * @format */ -import type { - RootTag, - TurboModule, -} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {RootTag, TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; type Animal = { name?: string, diff --git a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeStringTurboModule.js b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeStringTurboModule.js index 2ae70cf5a62..e16bfbf7fcb 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeStringTurboModule.js +++ b/packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/modules/NativeStringTurboModule.js @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; export type String = string; type AnotherString = String; diff --git a/packages/react-native-codegen/src/parsers/flow/modules/__test_fixtures__/fixtures.js b/packages/react-native-codegen/src/parsers/flow/modules/__test_fixtures__/fixtures.js index 9cc97dbef58..4d47112ffe7 100644 --- a/packages/react-native-codegen/src/parsers/flow/modules/__test_fixtures__/fixtures.js +++ b/packages/react-native-codegen/src/parsers/flow/modules/__test_fixtures__/fixtures.js @@ -234,11 +234,11 @@ const NATIVE_MODULE_WITH_FLOAT_AND_INT32 = ` import type {TurboModule} from '../RCTExport'; import * as TurboModuleRegistry from '../TurboModuleRegistry'; -import type {Int32, Float} from 'react-native/Libraries/Types/CodegenTypes'; +import type {CodegenTypes} from 'react-native'; export interface Spec extends TurboModule { - +getInt: (arg: Int32) => Int32; - +getFloat: (arg: Float) => Float; + +getInt: (arg: CodegenTypes.Int32) => CodegenTypes.Int32; + +getFloat: (arg: CodegenTypes.Float) => CodegenTypes.Float; } export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); @@ -283,10 +283,12 @@ const NATIVE_MODULE_WITH_UNSAFE_OBJECT = ` import type {TurboModule} from '../RCTExport'; import * as TurboModuleRegistry from '../TurboModuleRegistry'; -import type {UnsafeObject} from 'react-native/Libraries/Types/CodegenTypes'; +import type {CodegenTypes} from 'react-native'; export interface Spec extends TurboModule { - +getUnsafeObject: (o: UnsafeObject) => UnsafeObject, + +getUnsafeObject: ( + o: CodegenTypes.UnsafeObject, + ) => CodegenTypes.UnsafeObject, } export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); diff --git a/packages/react-native-codegen/src/parsers/typescript/modules/__test_fixtures__/failures.js b/packages/react-native-codegen/src/parsers/typescript/modules/__test_fixtures__/failures.js index 11b7f2b0851..a00880a5502 100644 --- a/packages/react-native-codegen/src/parsers/typescript/modules/__test_fixtures__/failures.js +++ b/packages/react-native-codegen/src/parsers/typescript/modules/__test_fixtures__/failures.js @@ -20,8 +20,8 @@ const NATIVE_MODULES_WITH_ARRAY_WITH_NO_TYPE_FOR_CONTENT = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { getString: (arg: string) => Array; @@ -40,8 +40,8 @@ const NATIVE_MODULES_WITH_ARRAY_WITH_NO_TYPE_FOR_CONTENT_AS_PARAM = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { getString: (arg: Array) => string; @@ -85,8 +85,8 @@ const NATIVE_MODULES_WITH_UNNAMED_PARAMS = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { readonly getBool: (boolean) => boolean; @@ -166,8 +166,8 @@ const EMPTY_ENUM_NATIVE_MODULE = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; export enum SomeEnum { } @@ -191,8 +191,8 @@ const MIXED_VALUES_ENUM_NATIVE_MODULE = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; export enum SomeEnum { NUM = 1, @@ -218,8 +218,8 @@ const NUMERIC_VALUES_ENUM_NATIVE_MODULE = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; export enum SomeEnum { NUM = 1, @@ -246,8 +246,8 @@ const MAP_WITH_EXTRA_KEYS_NATIVE_MODULE = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; type MapWithKey = { [a: string]: string | null, @@ -271,8 +271,8 @@ const NATIVE_MODULES_WITH_ARRAY_BUFFER_IN_OBJECT_PROPERTY = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; type Row = { buf: ArrayBuffer; @@ -296,8 +296,8 @@ const NATIVE_MODULES_WITH_ARRAY_BUFFER_IN_EVENT_EMITTER = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { readonly onBuffer: EventEmitter; diff --git a/packages/react-native-codegen/src/parsers/typescript/modules/__test_fixtures__/fixtures.js b/packages/react-native-codegen/src/parsers/typescript/modules/__test_fixtures__/fixtures.js index ddd35c961d9..071e96e4cd9 100644 --- a/packages/react-native-codegen/src/parsers/typescript/modules/__test_fixtures__/fixtures.js +++ b/packages/react-native-codegen/src/parsers/typescript/modules/__test_fixtures__/fixtures.js @@ -20,8 +20,8 @@ const EMPTY_NATIVE_MODULE = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { @@ -40,8 +40,8 @@ const NATIVE_MODULE_WITH_COMPLEX_OBJECTS = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; export type String = string; @@ -72,8 +72,8 @@ const NATIVE_MODULE_WITH_COMPLEX_OBJECTS_WITH_NULLABLE_KEY = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; export type String = string; @@ -134,8 +134,8 @@ const NATIVE_MODULE_WITH_ALIASES = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; type NumNum = number; export type Num = (arg: NumNum) => void; @@ -298,13 +298,12 @@ const NATIVE_MODULE_WITH_FLOAT_AND_INT32 = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import type {Int32, Float} from 'react-native/Libraries/Types/CodegenTypes'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {CodegenTypes, TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { - readonly getInt: (arg: Int32) => Int32; - readonly getFloat: (arg: Float) => Float; + readonly getInt: (arg: CodegenTypes.Int32) => CodegenTypes.Int32; + readonly getFloat: (arg: CodegenTypes.Float) => CodegenTypes.Float; } export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); @@ -320,8 +319,8 @@ const NATIVE_MODULE_WITH_SIMPLE_OBJECT = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { readonly getObject: (o: Object) => Object, @@ -340,12 +339,11 @@ const NATIVE_MODULE_WITH_UNSAFE_OBJECT = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; -import type {UnsafeObject} from 'react-native/Libraries/Types/CodegenTypes'; +import type {CodegenTypes, TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { - readonly getUnsafeObject: (o: UnsafeObject) => UnsafeObject; + readonly getUnsafeObject: (o: CodegenTypes.UnsafeObject) => CodegenTypes.UnsafeObject; } export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); @@ -361,8 +359,8 @@ const NATIVE_MODULE_WITH_PARTIALS = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; export type SomeObj = { a: string, @@ -388,8 +386,8 @@ const NATIVE_MODULE_WITH_PARTIALS_COMPLEX = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; export type SomeObj = { a: string, @@ -418,8 +416,8 @@ const NATIVE_MODULE_WITH_ROOT_TAG = ` import type { TurboModule, RootTag, -} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { readonly getRootTag: (rootTag: RootTag) => RootTag; @@ -438,8 +436,8 @@ const NATIVE_MODULE_WITH_NULLABLE_PARAM = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { readonly voidFunc: (arg: string | null | undefined) => void; @@ -458,8 +456,8 @@ const NATIVE_MODULE_WITH_BASIC_ARRAY = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { readonly getArray: (arg: Array) => (Array<(string)>); @@ -479,8 +477,8 @@ const NATIVE_MODULE_WITH_BASIC_ARRAY2 = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { readonly getArray: (arg: string[]) => ((string)[]); @@ -500,8 +498,8 @@ const NATIVE_MODULE_WITH_OBJECT_WITH_OBJECT_DEFINED_IN_FILE_AS_PROPERTY = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; type DisplayMetricsAndroid = { width: number; @@ -533,8 +531,8 @@ const NATIVE_MODULE_WITH_ARRAY_WITH_UNION_AND_TOUPLE = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { readonly getArray: ( @@ -555,8 +553,8 @@ const NATIVE_MODULE_WITH_ARRAY2_WITH_UNION_AND_TOUPLE = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { getArray( @@ -577,8 +575,8 @@ const NATIVE_MODULE_WITH_ARRAY_WITH_ALIAS = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; export type SomeString = string; @@ -599,8 +597,8 @@ const NATIVE_MODULE_WITH_ARRAY2_WITH_ALIAS = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; export type SomeString = string; @@ -621,8 +619,8 @@ const NATIVE_MODULE_WITH_COMPLEX_ARRAY = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { readonly getArray: ( @@ -643,8 +641,8 @@ const NATIVE_MODULE_WITH_COMPLEX_ARRAY2 = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { readonly getArray: ( @@ -665,8 +663,8 @@ const NATIVE_MODULE_WITH_PROMISE = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; export type String = string; export type SomeObj = { a: string }; @@ -690,8 +688,8 @@ const NATIVE_MODULE_WITH_CALLBACK = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { readonly getValueWithCallback: ( @@ -712,8 +710,8 @@ const NATIVE_MODULE_WITH_UNION = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; export type ChooseInt = 1 | 2 | 3; export type ChooseFloat = 1.44 | 2.88 | 5.76; @@ -738,8 +736,8 @@ const NATIVE_MODULE_WITH_UNION_RETURN_TYPES = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { readonly getStringUnion: () => 'light' | 'dark'; @@ -765,9 +763,8 @@ const NATIVE_MODULE_WITH_EVENT_EMITTERS = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import type {Double, Float, Int32} from 'react-native/Libraries/Types/CodegenTypes'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {CodegenTypes, TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; export type ObjectStruct = { a: number; @@ -778,16 +775,16 @@ export type ObjectStruct = { export type MappedObject = {[key: string]: string}; export interface Spec extends TurboModule { - readonly onEvent1: EventEmitter; - readonly onEvent2: EventEmitter; - readonly onEvent3: EventEmitter; - readonly onEvent4: EventEmitter; - readonly onEvent5: EventEmitter; - readonly onEvent6: EventEmitter; - readonly onEvent7: EventEmitter; - readonly onEvent8: EventEmitter; - readonly onEvent9: EventEmitter; - readonly onEvent10: EventEmitter; + readonly onEvent1: CodegenTypes.EventEmitter; + readonly onEvent2: CodegenTypes.EventEmitter; + readonly onEvent3: CodegenTypes.EventEmitter; + readonly onEvent4: CodegenTypes.EventEmitter; + readonly onEvent5: CodegenTypes.EventEmitter; + readonly onEvent6: CodegenTypes.EventEmitter; + readonly onEvent7: CodegenTypes.EventEmitter; + readonly onEvent8: CodegenTypes.EventEmitter; + readonly onEvent9: CodegenTypes.EventEmitter; + readonly onEvent10: CodegenTypes.EventEmitter; } export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); @@ -804,8 +801,8 @@ const ANDROID_ONLY_NATIVE_MODULE = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule {} @@ -824,8 +821,8 @@ const IOS_ONLY_NATIVE_MODULE = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; export enum Quality { SD, @@ -862,8 +859,8 @@ const CXX_ONLY_NATIVE_MODULE = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; export enum Quality { SD, @@ -930,9 +927,9 @@ const NAMESPACED_NATIVE_MODULE_WITH_FLOAT_AND_INT32 = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; import type {CodegenTypes} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { readonly getInt: (arg: CodegenTypes.Int32) => CodegenTypes.Int32; @@ -952,8 +949,8 @@ const NAMESPACED_NATIVE_MODULE_WITH_UNSAFE_OBJECT = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; import type {CodegenTypes} from 'react-native'; export interface Spec extends TurboModule { @@ -973,9 +970,9 @@ const NAMESPACED_NATIVE_MODULE_WITH_LOCAL_TYPE_ALIASES = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; import type {CodegenTypes} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; type Double = CodegenTypes.Double; type MyFloat = CodegenTypes.Float; @@ -998,9 +995,9 @@ const NAMESPACED_NATIVE_MODULE_WITH_EVENT_EMITTERS = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; import type {CodegenTypes} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; export type ObjectStruct = { a: number; @@ -1034,8 +1031,8 @@ const NATIVE_MODULE_WITH_ARRAY_BUFFER = ` * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {TurboModule} from 'react-native'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { readonly getArrayBuffer: () => ArrayBuffer; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-all-types/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-all-types/NativeComponent.js.flow index 5a9837f0cd4..b985b4a3748 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-all-types/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-all-types/NativeComponent.js.flow @@ -8,46 +8,39 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type {ColorValue} from 'react-native/Libraries/StyleSheet/StyleSheet'; import type { + CodegenTypes, + ColorValue, EdgeInsetsValue, + HostComponent, PointValue, -} from 'react-native/Libraries/StyleSheet/StyleSheetTypes'; -import type {RootTag} from 'react-native/Libraries/TurboModule/RCTExport'; -import type { - Double, - Float, - Int32, - UnsafeMixed, - WithDefault, -} from 'react-native/Libraries/Types/CodegenTypes'; + RootTag, + ViewProps, +} from 'react-native'; -import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeCommands, codegenNativeComponent} from 'react-native'; type NativeProps = Readonly<{ ...ViewProps, bool: boolean, string: string, - double: Double, - float: Float, - int: Int32, - mixed: UnsafeMixed, + double: CodegenTypes.Double, + float: CodegenTypes.Float, + int: CodegenTypes.Int32, + mixed: CodegenTypes.UnsafeMixed, - optionalBool?: WithDefault, - optionalString?: WithDefault, - optionalStringDiffDefault?: WithDefault, - optionalDouble?: WithDefault, - optionalFloat?: WithDefault, - optionalInt?: WithDefault, + optionalBool?: CodegenTypes.WithDefault, + optionalString?: CodegenTypes.WithDefault, + optionalStringDiffDefault?: CodegenTypes.WithDefault, + optionalDouble?: CodegenTypes.WithDefault, + optionalFloat?: CodegenTypes.WithDefault, + optionalInt?: CodegenTypes.WithDefault, reserverdEdgeInsets: EdgeInsetsValue, reservedPointValue: PointValue, - stringUnion?: WithDefault<'foo' | 'bar', 'bar'>, - intUnion?: WithDefault<1 | 2, 1>, + stringUnion?: CodegenTypes.WithDefault<'foo' | 'bar', 'bar'>, + intUnion?: CodegenTypes.WithDefault<1 | 2, 1>, nestedObject: Readonly<{ string: string, @@ -59,8 +52,11 @@ type NativeProps = Readonly<{ color: ColorValue, }>, - arrayStringUnion?: WithDefault, 'foo'>, - arrayStringUnionExtra?: WithDefault< + arrayStringUnion?: CodegenTypes.WithDefault< + ReadonlyArray<'foo' | 'bar'>, + 'foo', + >, + arrayStringUnionExtra?: CodegenTypes.WithDefault< ReadonlyArray<'foo' | 'bar' | 'baz'>, 'bar', >, @@ -82,19 +78,22 @@ type NativeProps = Readonly<{ type NativeType = HostComponent; -type Int = Int32; +type Int = CodegenTypes.Int32; type Str = string; type Bool = boolean; -type Fl = Float; -type Dbl = Double; +type Fl = CodegenTypes.Float; +type Dbl = CodegenTypes.Double; type CustomObj = {foo: string, bar: number}; -type CustomObj2 = {a: Int32, b: string}; +type CustomObj2 = {a: CodegenTypes.Int32, b: string}; interface NativeCommands { - readonly methodInt: (viewRef: React.ElementRef, a: Int32) => void; + readonly methodInt: ( + viewRef: React.ElementRef, + a: CodegenTypes.Int32, + ) => void; readonly methodIntString: ( viewRef: React.ElementRef, - a: Int32, + a: CodegenTypes.Int32, b: string, ) => void; readonly methodString: ( @@ -107,11 +106,11 @@ interface NativeCommands { ) => void; readonly methodFloat: ( viewRef: React.ElementRef, - a: Float, + a: CodegenTypes.Float, ) => void; readonly methodDouble: ( viewRef: React.ElementRef, - a: Double, + a: CodegenTypes.Double, ) => void; readonly methodIntAlias: ( @@ -137,7 +136,7 @@ interface NativeCommands { readonly methodIntArray: ( viewRef: React.ElementRef, - a: Array, + a: Array, ) => void; readonly methodStringArray: ( viewRef: React.ElementRef, @@ -149,11 +148,11 @@ interface NativeCommands { ) => void; readonly methodFloatArray: ( viewRef: React.ElementRef, - a: Array, + a: Array, ) => void; readonly methodDoubleArray: ( viewRef: React.ElementRef, - a: Array, + a: Array, ) => void; readonly methodCustomObjArray: ( viewRef: React.ElementRef, diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-all-basic-types-arrays/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-all-basic-types-arrays/NativeComponent.js.flow index a1943b0e7c3..33b73783a49 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-all-basic-types-arrays/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-all-basic-types-arrays/NativeComponent.js.flow @@ -8,16 +8,9 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type { - Double, - Float, - Int32, -} from 'react-native/Libraries/Types/CodegenTypes'; +import type {CodegenTypes, HostComponent, ViewProps} from 'react-native'; -import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeCommands, codegenNativeComponent} from 'react-native'; type NativeProps = Readonly<{ ...ViewProps, @@ -28,7 +21,7 @@ type NativeType = HostComponent; interface NativeCommands { readonly methodInt: ( viewRef: React.ElementRef, - a: Array, + a: Array, ) => void; readonly methodString: ( viewRef: React.ElementRef, @@ -40,11 +33,11 @@ interface NativeCommands { ) => void; readonly methodFloat: ( viewRef: React.ElementRef, - a: Array, + a: Array, ) => void; readonly methodDouble: ( viewRef: React.ElementRef, - a: Array, + a: Array, ) => void; } diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-all-basic-types/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-all-basic-types/NativeComponent.js.flow index a44068aa05b..dc335f050d2 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-all-basic-types/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-all-basic-types/NativeComponent.js.flow @@ -8,16 +8,9 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type { - Double, - Float, - Int32, -} from 'react-native/Libraries/Types/CodegenTypes'; +import type {CodegenTypes, HostComponent, ViewProps} from 'react-native'; -import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeCommands, codegenNativeComponent} from 'react-native'; type NativeProps = Readonly<{ ...ViewProps, @@ -26,7 +19,10 @@ type NativeProps = Readonly<{ type NativeType = HostComponent; interface NativeCommands { - readonly methodInt: (viewRef: React.ElementRef, a: Int32) => void; + readonly methodInt: ( + viewRef: React.ElementRef, + a: CodegenTypes.Int32, + ) => void; readonly methodString: ( viewRef: React.ElementRef, a: string, @@ -37,11 +33,11 @@ interface NativeCommands { ) => void; readonly methodFloat: ( viewRef: React.ElementRef, - a: Float, + a: CodegenTypes.Float, ) => void; readonly methodDouble: ( viewRef: React.ElementRef, - a: Double, + a: CodegenTypes.Double, ) => void; } diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-changed/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-changed/NativeComponent.js.flow index 3437f638115..5b8cda7e1ab 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-changed/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-changed/NativeComponent.js.flow @@ -8,11 +8,9 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; +import type {HostComponent, ViewProps} from 'react-native'; -import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeCommands, codegenNativeComponent} from 'react-native'; type NativeProps = Readonly<{ ...ViewProps, diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-extra-arg/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-extra-arg/NativeComponent.js.flow index 189ec583583..a13c5957eff 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-extra-arg/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-extra-arg/NativeComponent.js.flow @@ -8,12 +8,9 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type {Int32} from 'react-native/Libraries/Types/CodegenTypes'; +import type {CodegenTypes, HostComponent, ViewProps} from 'react-native'; -import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeCommands, codegenNativeComponent} from 'react-native'; type NativeProps = Readonly<{ ...ViewProps, @@ -24,7 +21,7 @@ type NativeType = HostComponent; interface NativeCommands { readonly methodInt: ( viewRef: React.ElementRef, - a: Int32, + a: CodegenTypes.Int32, b: string, ) => void; } diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-extra-command/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-extra-command/NativeComponent.js.flow index 39d3ba4aa93..185eff4528d 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-extra-command/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command-extra-command/NativeComponent.js.flow @@ -8,12 +8,9 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type {Int32} from 'react-native/Libraries/Types/CodegenTypes'; +import type {CodegenTypes, HostComponent, ViewProps} from 'react-native'; -import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeCommands, codegenNativeComponent} from 'react-native'; type NativeProps = Readonly<{ ...ViewProps, @@ -22,7 +19,10 @@ type NativeProps = Readonly<{ type NativeType = HostComponent; interface NativeCommands { - readonly methodInt: (viewRef: React.ElementRef, a: Int32) => void; + readonly methodInt: ( + viewRef: React.ElementRef, + a: CodegenTypes.Int32, + ) => void; readonly methodString: ( viewRef: React.ElementRef, a: string, diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command/NativeComponent.js.flow index 8767e91f5f8..42d0c2199d1 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-command/NativeComponent.js.flow @@ -8,12 +8,9 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type {Int32} from 'react-native/Libraries/Types/CodegenTypes'; +import type {CodegenTypes, HostComponent, ViewProps} from 'react-native'; -import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeCommands, codegenNativeComponent} from 'react-native'; type NativeProps = Readonly<{ ...ViewProps, @@ -22,7 +19,10 @@ type NativeProps = Readonly<{ type NativeType = HostComponent; interface NativeCommands { - readonly methodInt: (viewRef: React.ElementRef, a: Int32) => void; + readonly methodInt: ( + viewRef: React.ElementRef, + a: CodegenTypes.Int32, + ) => void; } export const Commands: NativeCommands = codegenNativeCommands({ diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-added-optional-prop/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-added-optional-prop/NativeComponent.js.flow index e8274cc23b7..244e2b9f721 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-added-optional-prop/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-added-optional-prop/NativeComponent.js.flow @@ -8,21 +8,16 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type { - Int32, - WithDefault, -} from 'react-native/Libraries/Types/CodegenTypes'; +import type {CodegenTypes, HostComponent, ViewProps} from 'react-native'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeComponent} from 'react-native'; export type Props = Readonly<{ ...ViewProps, text: string, - backgroundColor?: WithDefault, - height?: WithDefault, - width?: WithDefault, + backgroundColor?: CodegenTypes.WithDefault, + height?: CodegenTypes.WithDefault, + width?: CodegenTypes.WithDefault, }>; export default codegenNativeComponent( diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-added-required-prop/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-added-required-prop/NativeComponent.js.flow index 447b5e2587e..10cfe9ca86e 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-added-required-prop/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-added-required-prop/NativeComponent.js.flow @@ -8,21 +8,16 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type { - Int32, - WithDefault, -} from 'react-native/Libraries/Types/CodegenTypes'; +import type {CodegenTypes, HostComponent, ViewProps} from 'react-native'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeComponent} from 'react-native'; export type Props = Readonly<{ ...ViewProps, text: string, - backgroundColor?: WithDefault, - height?: WithDefault, - width: Int32, + backgroundColor?: CodegenTypes.WithDefault, + height?: CodegenTypes.WithDefault, + width: CodegenTypes.Int32, }>; export default codegenNativeComponent( diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-all-types/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-all-types/NativeComponent.js.flow index b015ec3a9c4..29349455bc4 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-all-types/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-all-types/NativeComponent.js.flow @@ -8,30 +8,23 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type { - Double, - Float, - Int32, - WithDefault, -} from 'react-native/Libraries/Types/CodegenTypes'; +import type {CodegenTypes, HostComponent, ViewProps} from 'react-native'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeComponent} from 'react-native'; export type Props = Readonly<{ ...ViewProps, bool: boolean, string: string, - double: Double, - float: Float, - int: Int32, - stringUnion: WithDefault<'foo' | 'bar', 'bar'>, - intUnion: WithDefault<1 | 2, 1>, + double: CodegenTypes.Double, + float: CodegenTypes.Float, + int: CodegenTypes.Int32, + stringUnion: CodegenTypes.WithDefault<'foo' | 'bar', 'bar'>, + intUnion: CodegenTypes.WithDefault<1 | 2, 1>, mixed: unknown, - backgroundColor?: WithDefault, - height?: WithDefault, + backgroundColor?: CodegenTypes.WithDefault, + height?: CodegenTypes.WithDefault, }>; export default codegenNativeComponent( diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-array-union-added/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-array-union-added/NativeComponent.js.flow index 8a7ea8935ef..cce9cdec10f 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-array-union-added/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-array-union-added/NativeComponent.js.flow @@ -8,15 +8,16 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type {WithDefault} from 'react-native/Libraries/Types/CodegenTypes'; +import type {CodegenTypes, HostComponent, ViewProps} from 'react-native'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeComponent} from 'react-native'; export type Props = Readonly<{ ...ViewProps, - sizes?: WithDefault, 'small'>, + sizes?: CodegenTypes.WithDefault< + ReadonlyArray<'small' | 'large' | 'huge'>, + 'small', + >, }>; export default codegenNativeComponent( diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-array-union/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-array-union/NativeComponent.js.flow index 83b0b79dddd..457746bee45 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-array-union/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-array-union/NativeComponent.js.flow @@ -8,15 +8,13 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type {WithDefault} from 'react-native/Libraries/Types/CodegenTypes'; +import type {CodegenTypes, HostComponent, ViewProps} from 'react-native'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeComponent} from 'react-native'; export type Props = Readonly<{ ...ViewProps, - sizes?: WithDefault, 'small'>, + sizes?: CodegenTypes.WithDefault, 'small'>, }>; export default codegenNativeComponent( diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-changes/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-changes/NativeComponent.js.flow index 7dedc01870a..bda7f2c74c3 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-changes/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-changes/NativeComponent.js.flow @@ -8,20 +8,15 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type { - Int32, - WithDefault, -} from 'react-native/Libraries/Types/CodegenTypes'; +import type {CodegenTypes, HostComponent, ViewProps} from 'react-native'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeComponent} from 'react-native'; export type Props = Readonly<{ ...ViewProps, - text: Int32, - backgroundColor?: WithDefault, - height?: WithDefault, + text: CodegenTypes.Int32, + backgroundColor?: CodegenTypes.WithDefault, + height?: CodegenTypes.WithDefault, }>; export default codegenNativeComponent( diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-default-change/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-default-change/NativeComponent.js.flow index 4f766acf374..39e88064958 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-default-change/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-default-change/NativeComponent.js.flow @@ -8,20 +8,15 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type { - Int32, - WithDefault, -} from 'react-native/Libraries/Types/CodegenTypes'; +import type {CodegenTypes, HostComponent, ViewProps} from 'react-native'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeComponent} from 'react-native'; export type Props = Readonly<{ ...ViewProps, text: string, - backgroundColor?: WithDefault, - height?: WithDefault, + backgroundColor?: CodegenTypes.WithDefault, + height?: CodegenTypes.WithDefault, }>; export default codegenNativeComponent( diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object-added-optional-key/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object-added-optional-key/NativeComponent.js.flow index f0a0791fc3c..1bab2137b2f 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object-added-optional-key/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object-added-optional-key/NativeComponent.js.flow @@ -8,25 +8,19 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type { - Float, - Int32, - WithDefault, -} from 'react-native/Libraries/Types/CodegenTypes'; +import type {CodegenTypes, HostComponent, ViewProps} from 'react-native'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeComponent} from 'react-native'; export type Props = Readonly<{ ...ViewProps, text: string, - backgroundColor?: WithDefault, - height?: WithDefault, + backgroundColor?: CodegenTypes.WithDefault, + height?: CodegenTypes.WithDefault, pins: Readonly<{ - x: Float, - y: Float, - color?: WithDefault, + x: CodegenTypes.Float, + y: CodegenTypes.Float, + color?: CodegenTypes.WithDefault, }>, }>; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object-added-required-key/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object-added-required-key/NativeComponent.js.flow index e9997e5cc87..4cec311ae1e 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object-added-required-key/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object-added-required-key/NativeComponent.js.flow @@ -8,24 +8,18 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type { - Float, - Int32, - WithDefault, -} from 'react-native/Libraries/Types/CodegenTypes'; +import type {CodegenTypes, HostComponent, ViewProps} from 'react-native'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeComponent} from 'react-native'; export type Props = Readonly<{ ...ViewProps, text: string, - backgroundColor?: WithDefault, - height?: WithDefault, + backgroundColor?: CodegenTypes.WithDefault, + height?: CodegenTypes.WithDefault, pins: Readonly<{ - x: Float, - y: Float, + x: CodegenTypes.Float, + y: CodegenTypes.Float, color: string, }>, }>; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object/NativeComponent.js.flow index aa3e584cf37..b3654a6f580 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-nested-object/NativeComponent.js.flow @@ -8,24 +8,18 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type { - Float, - Int32, - WithDefault, -} from 'react-native/Libraries/Types/CodegenTypes'; +import type {CodegenTypes, HostComponent, ViewProps} from 'react-native'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeComponent} from 'react-native'; export type Props = Readonly<{ ...ViewProps, text: string, - backgroundColor?: WithDefault, - height?: WithDefault, + backgroundColor?: CodegenTypes.WithDefault, + height?: CodegenTypes.WithDefault, pins: Readonly<{ - x: Float, - y: Float, + x: CodegenTypes.Float, + y: CodegenTypes.Float, }>, }>; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-union-added/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-union-added/NativeComponent.js.flow index a1f9fddbee0..8c9ac2ce32b 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-union-added/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-union-added/NativeComponent.js.flow @@ -8,15 +8,13 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type {WithDefault} from 'react-native/Libraries/Types/CodegenTypes'; +import type {CodegenTypes, HostComponent, ViewProps} from 'react-native'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeComponent} from 'react-native'; export type Props = Readonly<{ ...ViewProps, - size?: WithDefault<'small' | 'huge' | 'large', 'small'>, + size?: CodegenTypes.WithDefault<'small' | 'huge' | 'large', 'small'>, }>; export default codegenNativeComponent( diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-union/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-union/NativeComponent.js.flow index f3c11fac0cd..451e41087cc 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-union/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props-union/NativeComponent.js.flow @@ -8,15 +8,13 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type {WithDefault} from 'react-native/Libraries/Types/CodegenTypes'; +import type {CodegenTypes, HostComponent, ViewProps} from 'react-native'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeComponent} from 'react-native'; export type Props = Readonly<{ ...ViewProps, - size?: WithDefault<'small' | 'large', 'small'>, + size?: CodegenTypes.WithDefault<'small' | 'large', 'small'>, }>; export default codegenNativeComponent( diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props/NativeComponent.js.flow index 12e79a1a3c4..a47e8a36fd8 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component-with-props/NativeComponent.js.flow @@ -8,20 +8,15 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import type { - Int32, - WithDefault, -} from 'react-native/Libraries/Types/CodegenTypes'; +import type {CodegenTypes, HostComponent, ViewProps} from 'react-native'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeComponent} from 'react-native'; export type Props = Readonly<{ ...ViewProps, text: string, - backgroundColor?: WithDefault, - height?: WithDefault, + backgroundColor?: CodegenTypes.WithDefault, + height?: CodegenTypes.WithDefault, }>; export default codegenNativeComponent( diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component/NativeComponent.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component/NativeComponent.js.flow index c36ee482c63..7b46de0c1fd 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component/NativeComponent.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-component/NativeComponent.js.flow @@ -8,10 +8,9 @@ * @format */ -import type {HostComponent} from 'react-native'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; +import type {HostComponent, ViewProps} from 'react-native'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import {codegenNativeComponent} from 'react-native'; export type Props = Readonly<{ ...ViewProps, diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-before-after-types-removed/NativeModuleBeforeAfterTypes.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-before-after-types-removed/NativeModuleBeforeAfterTypes.js.flow index ef6d31fd0d5..a1e8b627729 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-before-after-types-removed/NativeModuleBeforeAfterTypes.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-before-after-types-removed/NativeModuleBeforeAfterTypes.js.flow @@ -9,9 +9,9 @@ /* eslint-disable no-unused-vars */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; type SimpleObject = {||}; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-before-after-types-type-changed/NativeModuleBeforeAfterTypes.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-before-after-types-type-changed/NativeModuleBeforeAfterTypes.js.flow index 14d6a70df8d..62da69cfda3 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-before-after-types-type-changed/NativeModuleBeforeAfterTypes.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-before-after-types-type-changed/NativeModuleBeforeAfterTypes.js.flow @@ -8,9 +8,9 @@ */ /* eslint-disable no-unused-vars */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; type SimpleObject = {||}; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-before-after-types/NativeModuleBeforeAfterTypes.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-before-after-types/NativeModuleBeforeAfterTypes.js.flow index 90e775dbc7c..1382951283d 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-before-after-types/NativeModuleBeforeAfterTypes.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-before-after-types/NativeModuleBeforeAfterTypes.js.flow @@ -9,9 +9,9 @@ /* eslint-disable no-unused-vars */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; type SimpleObject = {}; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-changed/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-changed/NativeModule.js.flow index 751c2b273b2..5b5624f603c 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-changed/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-changed/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { readonly exampleFunction: (a: string, b: number) => void; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-optional-constant-readonly/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-optional-constant-readonly/NativeModule.js.flow index 1ccfbb6c1bb..11113c76cd7 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-optional-constant-readonly/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-optional-constant-readonly/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { readonly exampleFunction: (a: string, b: number) => void; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-optional-constant/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-optional-constant/NativeModule.js.flow index 140a3f64eac..3b3769e83a1 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-optional-constant/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-optional-constant/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { readonly exampleFunction: (a: string, b: number) => void; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-required-constant-readonly/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-required-constant-readonly/NativeModule.js.flow index d6adf2fb039..81999947c6c 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-required-constant-readonly/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-required-constant-readonly/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { readonly exampleFunction: (a: string, b: number) => void; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-required-constant/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-required-constant/NativeModule.js.flow index fc1f8f5c968..341be5b8bab 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-required-constant/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-added-required-constant/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { readonly exampleFunction: (a: string, b: number) => void; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-readonly/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-readonly/NativeModule.js.flow index 8e940d86fec..aa6587da047 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-readonly/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants-readonly/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { readonly exampleFunction: (a: string, b: number) => void; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants/NativeModule.js.flow index b31c7fbba30..fc12dace2a5 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-get-constants/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { readonly exampleFunction: (a: string, b: number) => void; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-alias-changed/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-alias-changed/NativeModule.js.flow index 91b7c1a6eb8..9f5f577a4cc 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-alias-changed/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-alias-changed/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; type MyType = () => Promise; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-alias/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-alias/NativeModule.js.flow index 7bc0475822b..4c807f3e4e1 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-alias/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-alias/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; type MyType = () => Promise; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-changed/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-changed/NativeModule.js.flow index be9e6610524..115347371a7 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-changed/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-changed/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { readonly exampleFunction: ( diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-nullable/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-nullable/NativeModule.js.flow index 65cd98a27dd..c9727ce607b 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-nullable/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-nullable/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { readonly exampleFunction: ( diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-optional/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-optional/NativeModule.js.flow index de709bb05a9..7b284d82fab 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-optional/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested-optional/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { readonly exampleFunction: ( diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested/NativeModule.js.flow index 3b00a720e4d..796d3103fc4 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-nested/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { readonly exampleFunction: ( diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-type-diffing-types/NativeTypeDiffingTypes.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-type-diffing-types/NativeTypeDiffingTypes.js.flow index 0e2a9948587..a218675b5a5 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-type-diffing-types/NativeTypeDiffingTypes.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-type-diffing-types/NativeTypeDiffingTypes.js.flow @@ -9,10 +9,12 @@ /* eslint-disable no-unused-vars */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import type {UnsafeObject} from 'react-native/Libraries/Types/CodegenTypes'; +import type { + CodegenTypes, + TurboModule, +} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; type StringLiteral0 = 'foo'; type StringLiteral1 = 'bar'; @@ -108,7 +110,7 @@ type NonNullableType = Object; type NullableType = ?Object; type GenericObjectType = Object; -type UnsafeObjectType = UnsafeObject; +type UnsafeObjectType = CodegenTypes.UnsafeObject; type OptionalTypeLessProps = ?{ prop1: string, diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-dictionary-changed/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-dictionary-changed/NativeModule.js.flow index 9bc3d07fc9e..a4aebb8797c 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-dictionary-changed/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-dictionary-changed/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { readonly exampleFunction: (a: {[key: string]: string}, b: number) => void; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-dictionary/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-dictionary/NativeModule.js.flow index e7092067e47..ab024bf1673 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-dictionary/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-dictionary/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { readonly exampleFunction: (a: {[key: string]: number}, b: number) => void; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-changes/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-changes/NativeModule.js.flow index 57a4aaa4ac0..b9c726f0f6a 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-changes/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-changes/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; enum TestEnum { A = 1, diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-from-native-changes/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-from-native-changes/NativeModule.js.flow index b0d3a670ddf..e9bb75ab60d 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-from-native-changes/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-from-native-changes/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; enum TestEnum { A = 1, diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-from-native-type-changes/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-from-native-type-changes/NativeModule.js.flow index 829480d5635..de066f1cae2 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-from-native-type-changes/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-from-native-type-changes/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; enum TestEnum { A = '1', diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-from-native-value-changes/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-from-native-value-changes/NativeModule.js.flow index 8788d73a3e0..e92758e7791 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-from-native-value-changes/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-from-native-value-changes/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; enum TestEnum { A = 1, diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-from-native/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-from-native/NativeModule.js.flow index d903cf7ba2f..fbf56459b82 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-from-native/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-from-native/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; enum TestEnum { A = 1, diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-type-changes/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-type-changes/NativeModule.js.flow index 1ac7cd374c5..90c70cda788 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-type-changes/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-type-changes/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; enum TestEnum { A = '1', diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-value-changes/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-value-changes/NativeModule.js.flow index ca5d6c5cb7d..8032a7dd805 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-value-changes/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum-value-changes/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; enum TestEnum { A = 1, diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum/NativeModule.js.flow index d07fc73e166..26c947044c7 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-enum/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; enum TestEnum { A = 1, diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-eventemitter-changes/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-eventemitter-changes/NativeModule.js.flow index 9d632d7c2fa..9ec5d7fb751 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-eventemitter-changes/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-eventemitter-changes/NativeModule.js.flow @@ -8,10 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import type {EventEmitter} from 'react-native/Libraries/Types/CodegenTypes'; +import type {CodegenTypes, TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; export type ObjectStruct = { a: number, @@ -20,10 +19,10 @@ export type ObjectStruct = { }; export interface Spec extends TurboModule { - onPress: EventEmitter; - onClick: EventEmitter; - onChange: EventEmitter; - onSubmit: EventEmitter; + onPress: CodegenTypes.EventEmitter; + onClick: CodegenTypes.EventEmitter; + onChange: CodegenTypes.EventEmitter; + onSubmit: CodegenTypes.EventEmitter; } export default TurboModuleRegistry.getEnforcing( diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-eventemitter/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-eventemitter/NativeModule.js.flow index c993ddcb4bb..25f9d244309 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-eventemitter/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-eventemitter/NativeModule.js.flow @@ -8,10 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import type {EventEmitter} from 'react-native/Libraries/Types/CodegenTypes'; +import type {CodegenTypes, TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; export type ObjectStruct = { a: number, @@ -20,10 +19,10 @@ export type ObjectStruct = { }; export interface Spec extends TurboModule { - onPress: EventEmitter; - onClick: EventEmitter; - onChange: EventEmitter; - onSubmit: EventEmitter; + onPress: CodegenTypes.EventEmitter; + onClick: CodegenTypes.EventEmitter; + onChange: CodegenTypes.EventEmitter; + onSubmit: CodegenTypes.EventEmitter; } export default TurboModuleRegistry.getEnforcing( diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-optional-argument/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-optional-argument/NativeModule.js.flow index cfb6c420a55..9cd98c35fe2 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-optional-argument/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-optional-argument/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { readonly exampleFunction: (a: string, b: number, c?: number) => void; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-boolean-changes/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-boolean-changes/NativeModule.js.flow index 931f2b0b03a..006a874189a 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-boolean-changes/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-boolean-changes/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; // Changed to incompatible type type BooleanUnion = true | false; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-boolean/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-boolean/NativeModule.js.flow index 1f16fe5c225..6fc8b939fc6 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-boolean/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-boolean/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; type BooleanUnion = true; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-changes/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-changes/NativeModule.js.flow index e174a6bbfc9..29ae43db5f8 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-changes/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-changes/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; type testUnion = 'a' | 'b' | 'c' | 'd'; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-confusing-string-literals/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-confusing-string-literals/NativeModule.js.flow index b5faaa10647..cf7f4fa5279 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-confusing-string-literals/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-confusing-string-literals/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; type testUnion = 'a' | '0' | '1' | 'a long string'; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-from-native-changes/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-from-native-changes/NativeModule.js.flow index 650f086b854..0a5b3c4a5c8 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-from-native-changes/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-from-native-changes/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; type testUnion = 'a' | 'b' | 'c' | 'd'; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-from-native/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-from-native/NativeModule.js.flow index 983924e816c..1ab40731a15 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-from-native/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-from-native/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; type testUnion = 'a' | 'b' | 'c'; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-number-changes/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-number-changes/NativeModule.js.flow index 15e80722798..347cb7580a6 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-number-changes/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-number-changes/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; type NumberUnion = 4 | 5 | 6; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-number/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-number/NativeModule.js.flow index eaaeeaafe01..4eeacad1e1f 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-number/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-number/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; type NumberUnion = 1 | 2 | 3; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-object-added/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-object-added/NativeModule.js.flow index f5183eef7a5..310295a08ca 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-object-added/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-object-added/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; type ObjectA = {| kind: 'a', diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-object-changes/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-object-changes/NativeModule.js.flow index fc05ed87058..37e358efcc3 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-object-changes/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-object-changes/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; type ObjectA = {| kind: 'a', diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-object/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-object/NativeModule.js.flow index 3c23ff9a66f..b8301d3c602 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-object/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-object/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; type ObjectA = {| kind: 'a', diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-type-changes/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-type-changes/NativeModule.js.flow index 872c3754cb0..3c44e30f526 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-type-changes/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union-type-changes/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; type testUnion = 1 | 2 | 3; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union/NativeModule.js.flow index f77ea159571..c9b99811e26 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module-with-union/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; type testUnion = 'a' | 'b' | 'c'; diff --git a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module/NativeModule.js.flow b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module/NativeModule.js.flow index fc04caa5d46..e68e5136a0d 100644 --- a/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module/NativeModule.js.flow +++ b/packages/react-native-compatibility-check/src/__tests__/__fixtures__/native-module/NativeModule.js.flow @@ -8,9 +8,9 @@ * @format */ -import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {TurboModule} from 'react-native'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import {TurboModuleRegistry} from 'react-native'; export interface Spec extends TurboModule { readonly exampleFunction: (a: string, b: number) => void;