Skip to content

Commit

Permalink
Migrate NativeComponentType from codegenNativeComponent to HostCompon…
Browse files Browse the repository at this point in the history
…ent #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
  • Loading branch information
elicwhite authored and facebook-github-bot committed Sep 25, 2019
1 parent 1b4eaeb commit 0676ebf
Show file tree
Hide file tree
Showing 19 changed files with 39 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<{|
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions Libraries/Components/Switch/AndroidSwitchNativeComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -45,4 +45,4 @@ type NativeProps = $ReadOnly<{|

export default (codegenNativeComponent<NativeProps>(
'AndroidSwitch',
): NativeComponentType<NativeProps>);
): HostComponent<NativeProps>);
5 changes: 2 additions & 3 deletions Libraries/Modal/RCTModalHostViewNativeComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -116,4 +115,4 @@ type NativeProps = $ReadOnly<{|
export default (codegenNativeComponent<NativeProps>('ModalHostView', {
interfaceOnly: true,
paperComponentName: 'RCTModalHostView',
}): NativeComponentType<NativeProps>);
}): HostComponent<NativeProps>);
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -43,4 +43,4 @@ type NativeProps = $ReadOnly<{|

export default (codegenNativeComponent<NativeProps>(
'ArrayPropsNativeComponentView',
): NativeComponentType<NativeProps>);
): HostComponent<NativeProps>);
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -25,4 +25,4 @@ type NativeProps = $ReadOnly<{|

export default (codegenNativeComponent<NativeProps>(
'BooleanPropNativeComponentView',
): NativeComponentType<NativeProps>);
): HostComponent<NativeProps>);
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -24,4 +24,4 @@ type NativeProps = $ReadOnly<{|

export default (codegenNativeComponent<NativeProps>(
'ColorPropNativeComponentView',
): NativeComponentType<NativeProps>);
): HostComponent<NativeProps>);
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -24,4 +24,4 @@ type NativeProps = $ReadOnly<{|

export default (codegenNativeComponent<NativeProps>(
'EdgeInsetsPropNativeComponentView',
): NativeComponentType<NativeProps>);
): HostComponent<NativeProps>);
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -25,4 +25,4 @@ type NativeProps = $ReadOnly<{|

export default (codegenNativeComponent<NativeProps>(
'EnumPropNativeComponentView',
): NativeComponentType<NativeProps>);
): HostComponent<NativeProps>);
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -41,4 +41,4 @@ type NativeProps = $ReadOnly<{|

export default (codegenNativeComponent<NativeProps>(
'EventNestedObjectPropsNativeComponentView',
): NativeComponentType<NativeProps>);
): HostComponent<NativeProps>);
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -62,4 +62,4 @@ type NativeProps = $ReadOnly<{|

export default (codegenNativeComponent<NativeProps>(
'EventPropsNativeComponentView',
): NativeComponentType<NativeProps>);
): HostComponent<NativeProps>);
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -33,4 +33,4 @@ type NativeProps = $ReadOnly<{|

export default (codegenNativeComponent<NativeProps>(
'FloatPropsNativeComponentView',
): NativeComponentType<NativeProps>);
): HostComponent<NativeProps>);
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -24,4 +24,4 @@ type NativeProps = $ReadOnly<{|

export default (codegenNativeComponent<NativeProps>(
'ImagePropNativeComponentView',
): NativeComponentType<NativeProps>);
): HostComponent<NativeProps>);
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -29,4 +29,4 @@ type NativeProps = $ReadOnly<{|

export default (codegenNativeComponent<NativeProps>(
'IntegerPropNativeComponentView',
): NativeComponentType<NativeProps>);
): HostComponent<NativeProps>);
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -34,4 +34,4 @@ export default (codegenNativeComponent<NativeProps>(
interfaceOnly: true,
paperComponentName: 'RCTInterfaceOnlyComponent',
},
): NativeComponentType<NativeProps>);
): HostComponent<NativeProps>);
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -31,4 +31,4 @@ type NativeProps = $ReadOnly<{|

export default (codegenNativeComponent<NativeProps>(
'MultiNativePropNativeComponentView',
): NativeComponentType<NativeProps>);
): HostComponent<NativeProps>);
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -22,4 +22,4 @@ type NativeProps = $ReadOnly<{|

export default (codegenNativeComponent<NativeProps>(
'NoPropsNoEventsNativeComponentView',
): NativeComponentType<NativeProps>);
): HostComponent<NativeProps>);
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
Expand Down Expand Up @@ -50,4 +50,4 @@ type NativeProps = $ReadOnly<{|

export default (codegenNativeComponent<NativeProps>(
'ObjectPropsNativeComponent',
): NativeComponentType<NativeProps>);
): HostComponent<NativeProps>);
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -24,4 +24,4 @@ type NativeProps = $ReadOnly<{|

export default (codegenNativeComponent<NativeProps>(
'PointPropNativeComponentView',
): NativeComponentType<NativeProps>);
): HostComponent<NativeProps>);
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -25,4 +25,4 @@ type NativeProps = $ReadOnly<{|

export default (codegenNativeComponent<NativeProps>(
'StringPropNativeComponentView',
): NativeComponentType<NativeProps>);
): HostComponent<NativeProps>);

0 comments on commit 0676ebf

Please sign in to comment.