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
This commit is contained in:
Eli White
2019-09-25 11:44:38 -07:00
committed by Facebook Github Bot
parent 1b4eaeb184
commit 0676ebf79a
19 changed files with 39 additions and 41 deletions
@@ -19,9 +19,8 @@ import type {
Float,
} from 'react-native/Libraries/Types/CodegenTypes';
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
import codegenNativeComponent, {
type NativeComponentType,
} from 'react-native/Libraries/Utilities/codegenNativeComponent';
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes';
import * as React from 'react';
type DrawerStateEvent = $ReadOnly<{|
@@ -110,7 +109,7 @@ type NativeProps = $ReadOnly<{|
statusBarBackgroundColor?: ?ColorValue,
|}>;
type NativeType = NativeComponentType<NativeProps>;
type NativeType = HostComponent<NativeProps>;
interface NativeCommands {
+openDrawer: (viewRef: React.ElementRef<NativeType>) => void;
@@ -16,7 +16,7 @@ import type {
} from 'react-native/Libraries/Types/CodegenTypes';
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
import type {NativeComponentType} from 'react-native/Libraries/Utilities/codegenNativeComponent';
import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes';
import type {ColorValue} from '../../StyleSheet/StyleSheetTypes';
import type {ViewProps} from '../View/ViewPropTypes';
@@ -45,4 +45,4 @@ type NativeProps = $ReadOnly<{|
export default (codegenNativeComponent<NativeProps>(
'AndroidSwitch',
): NativeComponentType<NativeProps>);
): HostComponent<NativeProps>);
@@ -11,10 +11,9 @@
'use strict';
import codegenNativeComponent from '../Utilities/codegenNativeComponent';
import {type NativeComponentType} from '../Utilities/codegenNativeComponent';
import type {HostComponent} from '../Renderer/shims/ReactNativeTypes';
import type {
WithDefault,
BubblingEventHandler,
DirectEventHandler,
Int32,
} from '../Types/CodegenTypes';
@@ -116,4 +115,4 @@ type NativeProps = $ReadOnly<{|
export default (codegenNativeComponent<NativeProps>('ModalHostView', {
interfaceOnly: true,
paperComponentName: 'RCTModalHostView',
}): NativeComponentType<NativeProps>);
}): HostComponent<NativeProps>);
@@ -23,7 +23,7 @@ import type {
} from '../../../../../Libraries/Types/CodegenTypes';
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
import {type NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
import type {HostComponent} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
type NativeProps = $ReadOnly<{|
...ViewProps,
@@ -43,4 +43,4 @@ type NativeProps = $ReadOnly<{|
export default (codegenNativeComponent<NativeProps>(
'ArrayPropsNativeComponentView',
): NativeComponentType<NativeProps>);
): HostComponent<NativeProps>);
@@ -13,7 +13,7 @@
import type {WithDefault} from '../../../../../Libraries/Types/CodegenTypes';
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
import {type NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
import type {HostComponent} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
type NativeProps = $ReadOnly<{|
...ViewProps,
@@ -25,4 +25,4 @@ type NativeProps = $ReadOnly<{|
export default (codegenNativeComponent<NativeProps>(
'BooleanPropNativeComponentView',
): NativeComponentType<NativeProps>);
): HostComponent<NativeProps>);
@@ -13,7 +13,7 @@
import type {ColorValue} from '../../../../../Libraries/StyleSheet/StyleSheetTypes';
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
import {type NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
import type {HostComponent} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
type NativeProps = $ReadOnly<{|
...ViewProps,
@@ -24,4 +24,4 @@ type NativeProps = $ReadOnly<{|
export default (codegenNativeComponent<NativeProps>(
'ColorPropNativeComponentView',
): NativeComponentType<NativeProps>);
): HostComponent<NativeProps>);
@@ -13,7 +13,7 @@
import type {EdgeInsetsValue} from '../../../../../Libraries/StyleSheet/StyleSheetTypes';
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
import {type NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
import type {HostComponent} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
type NativeProps = $ReadOnly<{|
...ViewProps,
@@ -24,4 +24,4 @@ type NativeProps = $ReadOnly<{|
export default (codegenNativeComponent<NativeProps>(
'EdgeInsetsPropNativeComponentView',
): NativeComponentType<NativeProps>);
): HostComponent<NativeProps>);
@@ -13,7 +13,7 @@
import type {WithDefault} from '../../../../../Libraries/Types/CodegenTypes';
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
import {type NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
import type {HostComponent} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
type NativeProps = $ReadOnly<{|
...ViewProps,
@@ -25,4 +25,4 @@ type NativeProps = $ReadOnly<{|
export default (codegenNativeComponent<NativeProps>(
'EnumPropNativeComponentView',
): NativeComponentType<NativeProps>);
): HostComponent<NativeProps>);
@@ -17,7 +17,7 @@ import type {
} from '../../../../../Libraries/Types/CodegenTypes';
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
import {type NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
import type {HostComponent} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
type OnChangeEvent = $ReadOnly<{|
location: {
@@ -41,4 +41,4 @@ type NativeProps = $ReadOnly<{|
export default (codegenNativeComponent<NativeProps>(
'EventNestedObjectPropsNativeComponentView',
): NativeComponentType<NativeProps>);
): HostComponent<NativeProps>);
@@ -19,7 +19,7 @@ import type {
} from '../../../../../Libraries/Types/CodegenTypes';
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
import {type NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
import type {HostComponent} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
type OnChangeEvent = $ReadOnly<{|
value: boolean,
@@ -62,4 +62,4 @@ type NativeProps = $ReadOnly<{|
export default (codegenNativeComponent<NativeProps>(
'EventPropsNativeComponentView',
): NativeComponentType<NativeProps>);
): HostComponent<NativeProps>);
@@ -16,7 +16,7 @@ import type {
} from '../../../../../Libraries/Types/CodegenTypes';
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
import {type NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
import type {HostComponent} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
type NativeProps = $ReadOnly<{|
...ViewProps,
@@ -33,4 +33,4 @@ type NativeProps = $ReadOnly<{|
export default (codegenNativeComponent<NativeProps>(
'FloatPropsNativeComponentView',
): NativeComponentType<NativeProps>);
): HostComponent<NativeProps>);
@@ -13,7 +13,7 @@
import type {ImageSource} from '../../../../../Libraries/Image/ImageSource';
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
import {type NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
import type {HostComponent} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
type NativeProps = $ReadOnly<{|
...ViewProps,
@@ -24,4 +24,4 @@ type NativeProps = $ReadOnly<{|
export default (codegenNativeComponent<NativeProps>(
'ImagePropNativeComponentView',
): NativeComponentType<NativeProps>);
): HostComponent<NativeProps>);
@@ -16,7 +16,7 @@ import type {
} from '../../../../../Libraries/Types/CodegenTypes';
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
import {type NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
import type {HostComponent} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
type NativeProps = $ReadOnly<{|
...ViewProps,
@@ -29,4 +29,4 @@ type NativeProps = $ReadOnly<{|
export default (codegenNativeComponent<NativeProps>(
'IntegerPropNativeComponentView',
): NativeComponentType<NativeProps>);
): HostComponent<NativeProps>);
@@ -16,7 +16,7 @@ import type {
} from '../../../../../Libraries/Types/CodegenTypes';
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
import {type NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
import type {HostComponent} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
type NativeProps = $ReadOnly<{|
...ViewProps,
@@ -34,4 +34,4 @@ export default (codegenNativeComponent<NativeProps>(
interfaceOnly: true,
paperComponentName: 'RCTInterfaceOnlyComponent',
},
): NativeComponentType<NativeProps>);
): HostComponent<NativeProps>);
@@ -17,7 +17,7 @@ import type {
import type {ImageSource} from '../../../../../Libraries/Image/ImageSource';
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
import {type NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
import type {HostComponent} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
type NativeProps = $ReadOnly<{|
...ViewProps,
@@ -31,4 +31,4 @@ type NativeProps = $ReadOnly<{|
export default (codegenNativeComponent<NativeProps>(
'MultiNativePropNativeComponentView',
): NativeComponentType<NativeProps>);
): HostComponent<NativeProps>);
@@ -12,7 +12,7 @@
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
import {type NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
import type {HostComponent} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
type NativeProps = $ReadOnly<{|
...ViewProps,
@@ -22,4 +22,4 @@ type NativeProps = $ReadOnly<{|
export default (codegenNativeComponent<NativeProps>(
'NoPropsNoEventsNativeComponentView',
): NativeComponentType<NativeProps>);
): HostComponent<NativeProps>);
@@ -22,7 +22,7 @@ import type {
WithDefault,
} from '../../../../../Libraries/Types/CodegenTypes';
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
import type {NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
import type {HostComponent} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
type ObjectArrayPropType = $ReadOnly<{|
array: $ReadOnlyArray<string>,
@@ -50,4 +50,4 @@ type NativeProps = $ReadOnly<{|
export default (codegenNativeComponent<NativeProps>(
'ObjectPropsNativeComponent',
): NativeComponentType<NativeProps>);
): HostComponent<NativeProps>);
@@ -13,7 +13,7 @@
import type {PointValue} from '../../../../../Libraries/StyleSheet/StyleSheetTypes';
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
import {type NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
import type {HostComponent} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
type NativeProps = $ReadOnly<{|
...ViewProps,
@@ -24,4 +24,4 @@ type NativeProps = $ReadOnly<{|
export default (codegenNativeComponent<NativeProps>(
'PointPropNativeComponentView',
): NativeComponentType<NativeProps>);
): HostComponent<NativeProps>);
@@ -13,7 +13,7 @@
import type {WithDefault} from '../../../../../Libraries/Types/CodegenTypes';
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
import {type NativeComponentType} from '../../../../../Libraries/Utilities/codegenNativeComponent';
import type {HostComponent} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
type NativeProps = $ReadOnly<{|
...ViewProps,
@@ -25,4 +25,4 @@ type NativeProps = $ReadOnly<{|
export default (codegenNativeComponent<NativeProps>(
'StringPropNativeComponentView',
): NativeComponentType<NativeProps>);
): HostComponent<NativeProps>);