Skip to content

Commit 0676ebf

Browse files
elicwhitefacebook-github-bot
authored andcommitted
Migrate NativeComponentType from codegenNativeComponent to HostComponent #2
Summary: We need to migrate to HostComponent instead of the exported type from codegenNativeComponent which is the same type Changelog: [Internal] Migrate NativeComponentType from codegenNativeComponent to HostComponent Reviewed By: rickhanlonii Differential Revision: D17563307 fbshipit-source-id: 01c8fea8c67b33bed42ae28ffb8c132be87b9a7a
1 parent 1b4eaeb commit 0676ebf

19 files changed

+39
-41
lines changed

Libraries/Components/DrawerAndroid/AndroidDrawerLayoutNativeComponent.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ import type {
1919
Float,
2020
} from 'react-native/Libraries/Types/CodegenTypes';
2121
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
22-
import codegenNativeComponent, {
23-
type NativeComponentType,
24-
} from 'react-native/Libraries/Utilities/codegenNativeComponent';
22+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
23+
import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes';
2524
import * as React from 'react';
2625

2726
type DrawerStateEvent = $ReadOnly<{|
@@ -110,7 +109,7 @@ type NativeProps = $ReadOnly<{|
110109
statusBarBackgroundColor?: ?ColorValue,
111110
|}>;
112111

113-
type NativeType = NativeComponentType<NativeProps>;
112+
type NativeType = HostComponent<NativeProps>;
114113

115114
interface NativeCommands {
116115
+openDrawer: (viewRef: React.ElementRef<NativeType>) => void;

Libraries/Components/Switch/AndroidSwitchNativeComponent.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import type {
1616
} from 'react-native/Libraries/Types/CodegenTypes';
1717

1818
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
19-
import type {NativeComponentType} from 'react-native/Libraries/Utilities/codegenNativeComponent';
19+
import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes';
2020

2121
import type {ColorValue} from '../../StyleSheet/StyleSheetTypes';
2222
import type {ViewProps} from '../View/ViewPropTypes';
@@ -45,4 +45,4 @@ type NativeProps = $ReadOnly<{|
4545

4646
export default (codegenNativeComponent<NativeProps>(
4747
'AndroidSwitch',
48-
): NativeComponentType<NativeProps>);
48+
): HostComponent<NativeProps>);

Libraries/Modal/RCTModalHostViewNativeComponent.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@
1111
'use strict';
1212

1313
import codegenNativeComponent from '../Utilities/codegenNativeComponent';
14-
import {type NativeComponentType} from '../Utilities/codegenNativeComponent';
14+
import type {HostComponent} from '../Renderer/shims/ReactNativeTypes';
1515
import type {
1616
WithDefault,
17-
BubblingEventHandler,
1817
DirectEventHandler,
1918
Int32,
2019
} from '../Types/CodegenTypes';
@@ -116,4 +115,4 @@ type NativeProps = $ReadOnly<{|
116115
export default (codegenNativeComponent<NativeProps>('ModalHostView', {
117116
interfaceOnly: true,
118117
paperComponentName: 'RCTModalHostView',
119-
}): NativeComponentType<NativeProps>);
118+
}): HostComponent<NativeProps>);

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import type {
2323
} from '../../../../../Libraries/Types/CodegenTypes';
2424
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
2525
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
26-
import {type NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
26+
import type {HostComponent} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
2727

2828
type NativeProps = $ReadOnly<{|
2929
...ViewProps,
@@ -43,4 +43,4 @@ type NativeProps = $ReadOnly<{|
4343

4444
export default (codegenNativeComponent<NativeProps>(
4545
'ArrayPropsNativeComponentView',
46-
): NativeComponentType<NativeProps>);
46+
): HostComponent<NativeProps>);

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import type {WithDefault} from '../../../../../Libraries/Types/CodegenTypes';
1414
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
1515
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
16-
import {type NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
16+
import type {HostComponent} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
1717

1818
type NativeProps = $ReadOnly<{|
1919
...ViewProps,
@@ -25,4 +25,4 @@ type NativeProps = $ReadOnly<{|
2525

2626
export default (codegenNativeComponent<NativeProps>(
2727
'BooleanPropNativeComponentView',
28-
): NativeComponentType<NativeProps>);
28+
): HostComponent<NativeProps>);

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import type {ColorValue} from '../../../../../Libraries/StyleSheet/StyleSheetTypes';
1414
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
1515
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
16-
import {type NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
16+
import type {HostComponent} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
1717

1818
type NativeProps = $ReadOnly<{|
1919
...ViewProps,
@@ -24,4 +24,4 @@ type NativeProps = $ReadOnly<{|
2424

2525
export default (codegenNativeComponent<NativeProps>(
2626
'ColorPropNativeComponentView',
27-
): NativeComponentType<NativeProps>);
27+
): HostComponent<NativeProps>);

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import type {EdgeInsetsValue} from '../../../../../Libraries/StyleSheet/StyleSheetTypes';
1414
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
1515
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
16-
import {type NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
16+
import type {HostComponent} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
1717

1818
type NativeProps = $ReadOnly<{|
1919
...ViewProps,
@@ -24,4 +24,4 @@ type NativeProps = $ReadOnly<{|
2424

2525
export default (codegenNativeComponent<NativeProps>(
2626
'EdgeInsetsPropNativeComponentView',
27-
): NativeComponentType<NativeProps>);
27+
): HostComponent<NativeProps>);

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import type {WithDefault} from '../../../../../Libraries/Types/CodegenTypes';
1414
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
1515
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
16-
import {type NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
16+
import type {HostComponent} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
1717

1818
type NativeProps = $ReadOnly<{|
1919
...ViewProps,
@@ -25,4 +25,4 @@ type NativeProps = $ReadOnly<{|
2525

2626
export default (codegenNativeComponent<NativeProps>(
2727
'EnumPropNativeComponentView',
28-
): NativeComponentType<NativeProps>);
28+
): HostComponent<NativeProps>);

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import type {
1717
} from '../../../../../Libraries/Types/CodegenTypes';
1818
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
1919
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
20-
import {type NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
20+
import type {HostComponent} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
2121

2222
type OnChangeEvent = $ReadOnly<{|
2323
location: {
@@ -41,4 +41,4 @@ type NativeProps = $ReadOnly<{|
4141

4242
export default (codegenNativeComponent<NativeProps>(
4343
'EventNestedObjectPropsNativeComponentView',
44-
): NativeComponentType<NativeProps>);
44+
): HostComponent<NativeProps>);

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import type {
1919
} from '../../../../../Libraries/Types/CodegenTypes';
2020
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
2121
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
22-
import {type NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
22+
import type {HostComponent} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
2323

2424
type OnChangeEvent = $ReadOnly<{|
2525
value: boolean,
@@ -62,4 +62,4 @@ type NativeProps = $ReadOnly<{|
6262

6363
export default (codegenNativeComponent<NativeProps>(
6464
'EventPropsNativeComponentView',
65-
): NativeComponentType<NativeProps>);
65+
): HostComponent<NativeProps>);

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import type {
1616
} from '../../../../../Libraries/Types/CodegenTypes';
1717
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
1818
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
19-
import {type NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
19+
import type {HostComponent} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
2020

2121
type NativeProps = $ReadOnly<{|
2222
...ViewProps,
@@ -33,4 +33,4 @@ type NativeProps = $ReadOnly<{|
3333

3434
export default (codegenNativeComponent<NativeProps>(
3535
'FloatPropsNativeComponentView',
36-
): NativeComponentType<NativeProps>);
36+
): HostComponent<NativeProps>);

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import type {ImageSource} from '../../../../../Libraries/Image/ImageSource';
1414
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
1515
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
16-
import {type NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
16+
import type {HostComponent} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
1717

1818
type NativeProps = $ReadOnly<{|
1919
...ViewProps,
@@ -24,4 +24,4 @@ type NativeProps = $ReadOnly<{|
2424

2525
export default (codegenNativeComponent<NativeProps>(
2626
'ImagePropNativeComponentView',
27-
): NativeComponentType<NativeProps>);
27+
): HostComponent<NativeProps>);

packages/react-native-codegen/e2e/__test_fixtures__/components/IntegerPropNativeComponent.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import type {
1616
} from '../../../../../Libraries/Types/CodegenTypes';
1717
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
1818
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
19-
import {type NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
19+
import type {HostComponent} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
2020

2121
type NativeProps = $ReadOnly<{|
2222
...ViewProps,
@@ -29,4 +29,4 @@ type NativeProps = $ReadOnly<{|
2929

3030
export default (codegenNativeComponent<NativeProps>(
3131
'IntegerPropNativeComponentView',
32-
): NativeComponentType<NativeProps>);
32+
): HostComponent<NativeProps>);

packages/react-native-codegen/e2e/__test_fixtures__/components/InterfaceOnlyNativeComponent.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import type {
1616
} from '../../../../../Libraries/Types/CodegenTypes';
1717
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
1818
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
19-
import {type NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
19+
import type {HostComponent} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
2020

2121
type NativeProps = $ReadOnly<{|
2222
...ViewProps,
@@ -34,4 +34,4 @@ export default (codegenNativeComponent<NativeProps>(
3434
interfaceOnly: true,
3535
paperComponentName: 'RCTInterfaceOnlyComponent',
3636
},
37-
): NativeComponentType<NativeProps>);
37+
): HostComponent<NativeProps>);

packages/react-native-codegen/e2e/__test_fixtures__/components/MultiNativePropNativeComponent.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import type {
1717
import type {ImageSource} from '../../../../../Libraries/Image/ImageSource';
1818
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
1919
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
20-
import {type NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
20+
import type {HostComponent} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
2121

2222
type NativeProps = $ReadOnly<{|
2323
...ViewProps,
@@ -31,4 +31,4 @@ type NativeProps = $ReadOnly<{|
3131

3232
export default (codegenNativeComponent<NativeProps>(
3333
'MultiNativePropNativeComponentView',
34-
): NativeComponentType<NativeProps>);
34+
): HostComponent<NativeProps>);

packages/react-native-codegen/e2e/__test_fixtures__/components/NoPropsNoEventsNativeComponent.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
1414
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
15-
import {type NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
15+
import type {HostComponent} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
1616

1717
type NativeProps = $ReadOnly<{|
1818
...ViewProps,
@@ -22,4 +22,4 @@ type NativeProps = $ReadOnly<{|
2222

2323
export default (codegenNativeComponent<NativeProps>(
2424
'NoPropsNoEventsNativeComponentView',
25-
): NativeComponentType<NativeProps>);
25+
): HostComponent<NativeProps>);

packages/react-native-codegen/e2e/__test_fixtures__/components/ObjectPropsNativeComponent.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import type {
2222
WithDefault,
2323
} from '../../../../../Libraries/Types/CodegenTypes';
2424
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
25-
import type {NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
25+
import type {HostComponent} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
2626

2727
type ObjectArrayPropType = $ReadOnly<{|
2828
array: $ReadOnlyArray<string>,
@@ -50,4 +50,4 @@ type NativeProps = $ReadOnly<{|
5050

5151
export default (codegenNativeComponent<NativeProps>(
5252
'ObjectPropsNativeComponent',
53-
): NativeComponentType<NativeProps>);
53+
): HostComponent<NativeProps>);

packages/react-native-codegen/e2e/__test_fixtures__/components/PointPropNativeComponent.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import type {PointValue} from '../../../../../Libraries/StyleSheet/StyleSheetTypes';
1414
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
1515
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
16-
import {type NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
16+
import type {HostComponent} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
1717

1818
type NativeProps = $ReadOnly<{|
1919
...ViewProps,
@@ -24,4 +24,4 @@ type NativeProps = $ReadOnly<{|
2424

2525
export default (codegenNativeComponent<NativeProps>(
2626
'PointPropNativeComponentView',
27-
): NativeComponentType<NativeProps>);
27+
): HostComponent<NativeProps>);

packages/react-native-codegen/e2e/__test_fixtures__/components/StringPropNativeComponent.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import type {WithDefault} from '../../../../../Libraries/Types/CodegenTypes';
1414
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
1515
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
16-
import {type NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
16+
import type {HostComponent} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
1717

1818
type NativeProps = $ReadOnly<{|
1919
...ViewProps,
@@ -25,4 +25,4 @@ type NativeProps = $ReadOnly<{|
2525

2626
export default (codegenNativeComponent<NativeProps>(
2727
'StringPropNativeComponentView',
28-
): NativeComponentType<NativeProps>);
28+
): HostComponent<NativeProps>);

0 commit comments

Comments
 (0)