Skip to content

Commit c07c233

Browse files
rubennortemeta-codesync[bot]
authored andcommitted
Use public imports in Codegen fixtures (#58572)
Summary: Pull Request resolved: #58572 Migrate Codegen and compatibility fixtures from React Native deep imports to the public `react-native` entry point. Reference codegen-only types through the exported `CodegenTypes` namespace. Changelog: [Internal] Reviewed By: christophpurrer Differential Revision: D120537584
1 parent 4d886bf commit c07c233

102 files changed

Lines changed: 475 additions & 608 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/ArrayPropsNativeComponent.js

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,41 +8,38 @@
88
* @format
99
*/
1010

11-
import type {HostComponent} from 'react-native';
12-
import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes';
13-
import type {ImageSource} from 'react-native/Libraries/Image/ImageSource';
14-
import type {ColorValue} from 'react-native/Libraries/StyleSheet/StyleSheet';
1511
import type {
12+
CodegenTypes,
13+
ColorValue,
1614
DimensionValue,
1715
EdgeInsetsValue,
16+
HostComponent,
17+
ImageSource,
1818
PointValue,
19-
} from 'react-native/Libraries/StyleSheet/StyleSheetTypes';
20-
import type {
21-
Float,
22-
Int32,
23-
UnsafeMixed,
24-
WithDefault,
25-
} from 'react-native/Libraries/Types/CodegenTypes';
19+
ViewProps,
20+
} from 'react-native';
2621

27-
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
22+
import {codegenNativeComponent} from 'react-native';
2823

2924
type NativeProps = Readonly<{
3025
...ViewProps,
3126

3227
// Props
3328
names?: ReadonlyArray<string>,
3429
disableds?: ReadonlyArray<boolean>,
35-
progress?: ReadonlyArray<Int32>,
36-
radii?: ReadonlyArray<Float>,
30+
progress?: ReadonlyArray<CodegenTypes.Int32>,
31+
radii?: ReadonlyArray<CodegenTypes.Float>,
3732
colors?: ReadonlyArray<ColorValue>,
3833
srcs?: ReadonlyArray<ImageSource>,
3934
points?: ReadonlyArray<PointValue>,
4035
edgeInsets?: ReadonlyArray<EdgeInsetsValue>,
4136
dimensions?: ReadonlyArray<DimensionValue>,
42-
sizes?: WithDefault<ReadonlyArray<'small' | 'large'>, 'small'>,
37+
sizes?: CodegenTypes.WithDefault<ReadonlyArray<'small' | 'large'>, 'small'>,
4338
object?: ReadonlyArray<Readonly<{prop: string}>>,
44-
arrayOfObjects?: ReadonlyArray<Readonly<{prop1: Float, prop2: Int32}>>,
45-
arrayOfMixed?: ReadonlyArray<UnsafeMixed>,
39+
arrayOfObjects?: ReadonlyArray<
40+
Readonly<{prop1: CodegenTypes.Float, prop2: CodegenTypes.Int32}>,
41+
>,
42+
arrayOfMixed?: ReadonlyArray<CodegenTypes.UnsafeMixed>,
4643
}>;
4744

4845
export default codegenNativeComponent<NativeProps>(

packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/BooleanPropNativeComponent.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,16 @@
88
* @format
99
*/
1010

11-
import type {HostComponent} from 'react-native';
12-
import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes';
13-
import type {WithDefault} from 'react-native/Libraries/Types/CodegenTypes';
11+
import type {CodegenTypes, HostComponent, ViewProps} from 'react-native';
1412

15-
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
13+
import {codegenNativeComponent} from 'react-native';
1614

1715
type NativeProps = Readonly<{
1816
...ViewProps,
1917

2018
// Props
21-
disabled?: WithDefault<boolean, false>,
22-
disabledNullable?: WithDefault<boolean, null>,
19+
disabled?: CodegenTypes.WithDefault<boolean, false>,
20+
disabledNullable?: CodegenTypes.WithDefault<boolean, null>,
2321
}>;
2422

2523
export default codegenNativeComponent<NativeProps>(

packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/ColorPropNativeComponent.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@
88
* @format
99
*/
1010

11-
import type {HostComponent} from 'react-native';
12-
import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes';
13-
import type {ColorValue} from 'react-native/Libraries/StyleSheet/StyleSheet';
11+
import type {ColorValue, HostComponent, ViewProps} from 'react-native';
1412

15-
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
13+
import {codegenNativeComponent} from 'react-native';
1614

1715
type NativeProps = Readonly<{
1816
...ViewProps,

packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/DimensionPropNativeComponent.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@
88
* @format
99
*/
1010

11-
import type {HostComponent} from 'react-native';
12-
import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes';
13-
import type {DimensionValue} from 'react-native/Libraries/StyleSheet/StyleSheetTypes';
11+
import type {DimensionValue, HostComponent, ViewProps} from 'react-native';
1412

15-
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
13+
import {codegenNativeComponent} from 'react-native';
1614

1715
type NativeProps = Readonly<{
1816
...ViewProps,

packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/EdgeInsetsPropNativeComponent.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@
88
* @format
99
*/
1010

11-
import type {HostComponent} from 'react-native';
12-
import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes';
11+
import type {HostComponent, ViewProps} from 'react-native';
1312

14-
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
13+
import {codegenNativeComponent} from 'react-native';
1514

1615
type NativeProps = Readonly<{
1716
...ViewProps,

packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/EnumPropNativeComponent.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,19 @@
88
* @format
99
*/
1010

11-
import type {HostComponent} from 'react-native';
12-
import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes';
13-
import type {WithDefault} from 'react-native/Libraries/Types/CodegenTypes';
11+
import type {CodegenTypes, HostComponent, ViewProps} from 'react-native';
1412

15-
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
13+
import {codegenNativeComponent} from 'react-native';
1614

1715
type NativeProps = Readonly<{
1816
...ViewProps,
1917

2018
// Props
21-
alignment?: WithDefault<'top' | 'center' | 'bottom-right', 'center'>,
22-
intervals?: WithDefault<0 | 15 | 30 | 60, 0>,
19+
alignment?: CodegenTypes.WithDefault<
20+
'top' | 'center' | 'bottom-right',
21+
'center',
22+
>,
23+
intervals?: CodegenTypes.WithDefault<0 | 15 | 30 | 60, 0>,
2324
}>;
2425

2526
export default codegenNativeComponent<NativeProps>(

packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/EventNestedObjectPropsNativeComponent.js

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,15 @@
88
* @format
99
*/
1010

11-
import type {HostComponent} from 'react-native';
12-
import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes';
13-
import type {
14-
BubblingEventHandler,
15-
Int32,
16-
WithDefault,
17-
} from 'react-native/Libraries/Types/CodegenTypes';
11+
import type {CodegenTypes, HostComponent, ViewProps} from 'react-native';
1812

19-
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
13+
import {codegenNativeComponent} from 'react-native';
2014

2115
type OnChangeEvent = Readonly<{
2216
location: {
2317
source: {url: string, ...},
24-
x: Int32,
25-
y: Int32,
18+
x: CodegenTypes.Int32,
19+
y: CodegenTypes.Int32,
2620
arrayOfObjects: ReadonlyArray<{value: Readonly<{str: string}>}>,
2721
...
2822
},
@@ -32,10 +26,10 @@ type NativeProps = Readonly<{
3226
...ViewProps,
3327

3428
// Props
35-
disabled?: WithDefault<boolean, false>,
29+
disabled?: CodegenTypes.WithDefault<boolean, false>,
3630

3731
// Events
38-
onChange?: ?BubblingEventHandler<OnChangeEvent>,
32+
onChange?: ?CodegenTypes.BubblingEventHandler<OnChangeEvent>,
3933
}>;
4034

4135
export default codegenNativeComponent<NativeProps>(

packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/EventPropsNativeComponent.js

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,15 @@
88
* @format
99
*/
1010

11-
import type {HostComponent} from 'react-native';
12-
import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes';
13-
import type {
14-
BubblingEventHandler,
15-
DirectEventHandler,
16-
Float,
17-
Int32,
18-
WithDefault,
19-
} from 'react-native/Libraries/Types/CodegenTypes';
11+
import type {CodegenTypes, HostComponent, ViewProps} from 'react-native';
2012

21-
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
13+
import {codegenNativeComponent} from 'react-native';
2214

2315
type OnChangeEvent = Readonly<{
2416
value: boolean,
2517
source?: string,
26-
progress: ?Int32,
27-
scale?: ?Float,
18+
progress: ?CodegenTypes.Int32,
19+
scale?: ?CodegenTypes.Float,
2820
}>;
2921

3022
type OnEventDirect = Readonly<{
@@ -39,21 +31,24 @@ type NativeProps = Readonly<{
3931
...ViewProps,
4032

4133
// Props
42-
disabled?: WithDefault<boolean, false>,
34+
disabled?: CodegenTypes.WithDefault<boolean, false>,
4335

4436
// Events
45-
onChange?: ?BubblingEventHandler<OnChangeEvent, 'paperDirectName'>,
46-
onEventDirect?: ?DirectEventHandler<OnEventDirect>,
47-
onEventDirectWithPaperName?: ?DirectEventHandler<
37+
onChange?: ?CodegenTypes.BubblingEventHandler<
38+
OnChangeEvent,
39+
'paperDirectName',
40+
>,
41+
onEventDirect?: ?CodegenTypes.DirectEventHandler<OnEventDirect>,
42+
onEventDirectWithPaperName?: ?CodegenTypes.DirectEventHandler<
4843
OnEventDirect,
4944
'paperDirectName',
5045
>,
51-
onOrientationChange?: ?DirectEventHandler<
46+
onOrientationChange?: ?CodegenTypes.DirectEventHandler<
5247
OnOrientationChangeEvent,
5348
'paperBubblingName',
5449
>,
55-
onEnd?: ?BubblingEventHandler<null>,
56-
onEventBubblingWithPaperName?: ?BubblingEventHandler<
50+
onEnd?: ?CodegenTypes.BubblingEventHandler<null>,
51+
onEventBubblingWithPaperName?: ?CodegenTypes.BubblingEventHandler<
5752
null,
5853
'paperBubblingName',
5954
>,

packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/FloatPropsNativeComponent.js

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,21 @@
88
* @format
99
*/
1010

11-
import type {HostComponent} from 'react-native';
12-
import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes';
13-
import type {
14-
Float,
15-
WithDefault,
16-
} from 'react-native/Libraries/Types/CodegenTypes';
11+
import type {CodegenTypes, HostComponent, ViewProps} from 'react-native';
1712

18-
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
13+
import {codegenNativeComponent} from 'react-native';
1914

2015
type NativeProps = Readonly<{
2116
...ViewProps,
2217

2318
// Props
24-
blurRadius: Float,
25-
blurRadius2?: WithDefault<Float, 0.001>,
26-
blurRadius3?: WithDefault<Float, 2.1>,
27-
blurRadius4?: WithDefault<Float, 0>,
28-
blurRadius5?: WithDefault<Float, 1>,
29-
blurRadius6?: WithDefault<Float, -0.0>,
30-
blurRadiusNullable?: WithDefault<Float, null>,
19+
blurRadius: CodegenTypes.Float,
20+
blurRadius2?: CodegenTypes.WithDefault<CodegenTypes.Float, 0.001>,
21+
blurRadius3?: CodegenTypes.WithDefault<CodegenTypes.Float, 2.1>,
22+
blurRadius4?: CodegenTypes.WithDefault<CodegenTypes.Float, 0>,
23+
blurRadius5?: CodegenTypes.WithDefault<CodegenTypes.Float, 1>,
24+
blurRadius6?: CodegenTypes.WithDefault<CodegenTypes.Float, -0.0>,
25+
blurRadiusNullable?: CodegenTypes.WithDefault<CodegenTypes.Float, null>,
3126
}>;
3227

3328
export default codegenNativeComponent<NativeProps>(

packages/react-native-codegen/e2e/deep_imports/__test_fixtures__/components/ImagePropNativeComponent.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@
88
* @format
99
*/
1010

11-
import type {HostComponent} from 'react-native';
12-
import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes';
13-
import type {ImageSource} from 'react-native/Libraries/Image/ImageSource';
11+
import type {HostComponent, ImageSource, ViewProps} from 'react-native';
1412

15-
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
13+
import {codegenNativeComponent} from 'react-native';
1614

1715
type NativeProps = Readonly<{
1816
...ViewProps,

0 commit comments

Comments
 (0)