diff --git a/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/failures.js b/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/failures.js index dca85562f76..63057844fea 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/failures.js +++ b/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/failures.js @@ -28,7 +28,7 @@ const codegenNativeComponent = require('codegenNativeComponent'); import type {Int32} from 'CodegenTypes'; import type {ViewProps} from 'ViewPropTypes'; -import type {NativeComponent} from 'codegenNativeComponent'; +import type {HostComponent} from 'react-native'; export type ModuleProps = $ReadOnly<{| ...ViewProps, @@ -43,7 +43,7 @@ export const Commands = codegenNativeCommands<{ export default (codegenNativeComponent( 'Module', -): NativeComponent); +): HostComponent); `; const COMMANDS_DEFINED_MULTIPLE_TIMES = ` @@ -64,7 +64,7 @@ const codegenNativeComponent = require('codegenNativeComponent'); import type {Int32} from 'CodegenTypes'; import type {ViewProps} from 'ViewPropTypes'; -import type {NativeComponent} from 'codegenNativeComponent'; +import type {HostComponent} from 'react-native'; interface NativeCommands { +hotspotUpdate: (viewRef: React.Ref<'RCTView'>, x: Int32, y: Int32) => void; @@ -84,7 +84,7 @@ export const Commands2 = codegenNativeCommands({ export default (codegenNativeComponent( 'Module', -): NativeComponent); +): HostComponent); `; const COMMANDS_DEFINED_WITHOUT_REF = ` @@ -105,7 +105,7 @@ const codegenNativeComponent = require('codegenNativeComponent'); import type {Int32} from 'CodegenTypes'; import type {ViewProps} from 'ViewPropTypes'; -import type {NativeComponent} from 'codegenNativeComponent'; +import type {HostComponent} from 'react-native'; interface NativeCommands { +hotspotUpdate: (x: Int32, y: Int32) => void; @@ -122,7 +122,7 @@ export const Commands = codegenNativeCommands({ export default (codegenNativeComponent( 'Module', -): NativeComponent); +): HostComponent); `; const COMMANDS_DEFINED_WITH_NULLABLE_REF = ` @@ -143,7 +143,7 @@ const codegenNativeComponent = require('codegenNativeComponent'); import type {Int32} from 'CodegenTypes'; import type {ViewProps} from 'ViewPropTypes'; -import type {NativeComponent} from 'codegenNativeComponent'; +import type {HostComponent} from 'react-native'; interface NativeCommands { +hotspotUpdate: (viewRef: ?React.Ref<'RCTView'>, x: Int32, y: Int32) => void; @@ -160,7 +160,7 @@ export const Commands = codegenNativeCommands({ export default (codegenNativeComponent( 'Module', -): NativeComponent); +): HostComponent); `; const COMMANDS_DEFINED_WITH_MISMATCHED_METHOD_NAMES = ` @@ -181,7 +181,7 @@ const codegenNativeComponent = require('codegenNativeComponent'); import type {Int32} from 'CodegenTypes'; import type {ViewProps} from 'ViewPropTypes'; -import type {NativeComponent} from 'codegenNativeComponent'; +import type {HostComponent} from 'react-native'; interface NativeCommands { +hotspotUpdate: (viewRef: React.Ref<'RCTView'>, x: Int32, y: Int32) => void; @@ -203,7 +203,7 @@ export const Commands = codegenNativeCommands({ export default (codegenNativeComponent( 'Module', -): NativeComponent); +): HostComponent); `; const COMMANDS_DEFINED_WITHOUT_METHOD_NAMES = ` @@ -224,7 +224,7 @@ const codegenNativeComponent = require('codegenNativeComponent'); import type {Int32} from 'CodegenTypes'; import type {ViewProps} from 'ViewPropTypes'; -import type {NativeComponent} from 'codegenNativeComponent'; +import type {HostComponent} from 'react-native'; interface NativeCommands { +hotspotUpdate: (viewRef: React.Ref<'RCTView'>, x: Int32, y: Int32) => void; @@ -244,7 +244,7 @@ export const Commands = codegenNativeCommands(); export default (codegenNativeComponent( 'Module', -): NativeComponent); +): HostComponent); `; const NULLABLE_WITH_DEFAULT = ` @@ -264,7 +264,7 @@ const codegenNativeComponent = require('codegenNativeComponent'); import type {WithDefault, Float} from 'CodegenTypes'; import type {ViewProps} from 'ViewPropTypes'; -import type {NativeComponent} from 'codegenNativeComponent'; +import type {HostComponent} from 'react-native'; export type ModuleProps = $ReadOnly<{| ...ViewProps, @@ -273,7 +273,7 @@ export type ModuleProps = $ReadOnly<{| export default (codegenNativeComponent( 'Module', -): NativeComponent); +): HostComponent); `; const NON_OPTIONAL_KEY_WITH_DEFAULT_VALUE = ` @@ -293,7 +293,7 @@ const codegenNativeComponent = require('codegenNativeComponent'); import type {WithDefault, Float} from 'CodegenTypes'; import type {ViewProps} from 'ViewPropTypes'; -import type {NativeComponent} from 'codegenNativeComponent'; +import type {HostComponent} from 'react-native'; export type ModuleProps = $ReadOnly<{| ...ViewProps, @@ -302,7 +302,7 @@ export type ModuleProps = $ReadOnly<{| export default (codegenNativeComponent( 'Module', -): NativeComponent); +): HostComponent); `; const PROPS_CONFLICT_NAMES = ` @@ -319,7 +319,7 @@ const PROPS_CONFLICT_NAMES = ` 'use strict'; import type {ViewProps} from 'ViewPropTypes'; -import type {NativeComponent} from 'codegenNativeComponent'; +import type {HostComponent} from 'react-native'; const codegenNativeComponent = require('codegenNativeComponent'); @@ -332,7 +332,7 @@ export type ModuleProps = $ReadOnly<{| export default (codegenNativeComponent( 'Module', -): NativeComponent); +): HostComponent); `; const PROPS_CONFLICT_WITH_SPREAD_PROPS = ` @@ -349,7 +349,7 @@ const PROPS_CONFLICT_WITH_SPREAD_PROPS = ` 'use strict'; import type {ViewProps} from 'ViewPropTypes'; -import type {NativeComponent} from 'codegenNativeComponent'; +import type {HostComponent} from 'react-native'; const codegenNativeComponent = require('codegenNativeComponent'); @@ -366,7 +366,7 @@ export type ModuleProps = $ReadOnly<{| export default (codegenNativeComponent( 'Module', -): NativeComponent); +): HostComponent); `; const PROPS_SPREAD_CONFLICTS_WITH_PROPS = ` @@ -383,7 +383,7 @@ const PROPS_SPREAD_CONFLICTS_WITH_PROPS = ` 'use strict'; import type {ViewProps} from 'ViewPropTypes'; -import type {NativeComponent} from 'codegenNativeComponent'; +import type {HostComponent} from 'react-native'; const codegenNativeComponent = require('codegenNativeComponent'); @@ -400,7 +400,7 @@ export type ModuleProps = $ReadOnly<{| export default (codegenNativeComponent( 'Module', -): NativeComponent); +): HostComponent); `; const PROP_NUMBER_TYPE = ` @@ -417,7 +417,7 @@ const PROP_NUMBER_TYPE = ` 'use strict'; import type {ViewProps} from 'ViewPropTypes'; -import type {NativeComponent} from 'codegenNativeComponent'; +import type {HostComponent} from 'react-native'; const codegenNativeComponent = require('codegenNativeComponent'); @@ -429,7 +429,7 @@ export type ModuleProps = $ReadOnly<{| export default (codegenNativeComponent( 'Module', -): NativeComponent); +): HostComponent); `; const PROP_MIXED_ENUM = ` @@ -446,7 +446,7 @@ const PROP_MIXED_ENUM = ` 'use strict'; import type {ViewProps} from 'ViewPropTypes'; -import type {NativeComponent} from 'codegenNativeComponent'; +import type {HostComponent} from 'react-native'; const codegenNativeComponent = require('codegenNativeComponent'); @@ -458,7 +458,7 @@ export type ModuleProps = $ReadOnly<{| export default (codegenNativeComponent( 'Module', -): NativeComponent); +): HostComponent); `; const PROP_ENUM_BOOLEAN = ` @@ -475,7 +475,7 @@ const PROP_ENUM_BOOLEAN = ` 'use strict'; import type {ViewProps} from 'ViewPropTypes'; -import type {NativeComponent} from 'codegenNativeComponent'; +import type {HostComponent} from 'react-native'; const codegenNativeComponent = require('codegenNativeComponent'); @@ -487,7 +487,7 @@ export type ModuleProps = $ReadOnly<{| export default (codegenNativeComponent( 'Module', -): NativeComponent); +): HostComponent); `; const PROP_ARRAY_MIXED_ENUM = ` @@ -504,7 +504,7 @@ const PROP_ARRAY_MIXED_ENUM = ` 'use strict'; import type {ViewProps} from 'ViewPropTypes'; -import type {NativeComponent} from 'codegenNativeComponent'; +import type {HostComponent} from 'react-native'; const codegenNativeComponent = require('codegenNativeComponent'); @@ -516,7 +516,7 @@ export type ModuleProps = $ReadOnly<{| export default (codegenNativeComponent( 'Module', -): NativeComponent); +): HostComponent); `; const PROP_ARRAY_ENUM_BOOLEAN = ` @@ -533,7 +533,7 @@ const PROP_ARRAY_ENUM_BOOLEAN = ` 'use strict'; import type {ViewProps} from 'ViewPropTypes'; -import type {NativeComponent} from 'codegenNativeComponent'; +import type {HostComponent} from 'react-native'; const codegenNativeComponent = require('codegenNativeComponent'); @@ -545,7 +545,7 @@ export type ModuleProps = $ReadOnly<{| export default (codegenNativeComponent( 'Module', -): NativeComponent); +): HostComponent); `; const PROP_ARRAY_ENUM_INT = ` @@ -562,7 +562,7 @@ const PROP_ARRAY_ENUM_INT = ` 'use strict'; import type {ViewProps} from 'ViewPropTypes'; -import type {NativeComponent} from 'codegenNativeComponent'; +import type {HostComponent} from 'react-native'; const codegenNativeComponent = require('codegenNativeComponent'); @@ -574,7 +574,7 @@ export type ModuleProps = $ReadOnly<{| export default (codegenNativeComponent( 'Module', -): NativeComponent); +): HostComponent); `; module.exports = { diff --git a/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/fixtures.js b/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/fixtures.js index 3a33bf3e31f..b7a47499fb9 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/fixtures.js +++ b/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/fixtures.js @@ -89,7 +89,7 @@ import type { WithDefault, } from 'CodegenTypes'; import type {ViewProps} from 'ViewPropTypes'; -import type {NativeComponent} from 'codegenNativeComponent'; +import type {HostComponent} from 'react-native'; type ModuleProps = $ReadOnly<{| ...ViewProps, @@ -105,7 +105,7 @@ type ModuleProps = $ReadOnly<{| export default (codegenNativeComponent('Module', { interfaceOnly: true, paperComponentName: 'RCTModule', -}): NativeComponent); +}): HostComponent); `; const ONE_OF_EACH_PROP_EVENT_DEFAULT_AND_OPTIONS_NO_CAST = ` @@ -129,7 +129,7 @@ import type { WithDefault, } from 'CodegenTypes'; import type {ViewProps} from 'ViewPropTypes'; -import type {NativeComponent} from 'codegenNativeComponent'; +import type {HostComponent} from 'react-native'; type ModuleProps = $ReadOnly<{| ...ViewProps, @@ -164,7 +164,7 @@ const NO_PROPS_EVENTS_ONLY_DEPRECATED_VIEW_CONFIG_NAME_OPTION = ` const codegenNativeComponent = require('codegenNativeComponent'); import type {ViewProps} from 'ViewPropTypes'; -import type {NativeComponent} from 'codegenNativeComponent'; +import type {HostComponent} from 'react-native'; type ModuleProps = $ReadOnly<{| ...ViewProps, @@ -172,7 +172,7 @@ type ModuleProps = $ReadOnly<{| export default (codegenNativeComponent('Module', { deprecatedViewConfigName: 'DeprecateModuleName', -}): NativeComponent); +}): HostComponent); `; const ALL_PROP_TYPES_NO_EVENTS = ` @@ -194,7 +194,7 @@ import type {Int32, Double, Float, WithDefault} from 'CodegenTypes'; import type {ImageSource} from 'ImageSource'; import type {ColorValue, ColorArrayValue, PointValue, EdgeInsetsValue} from 'StyleSheetTypes'; import type {ViewProps} from 'ViewPropTypes'; -import type {NativeComponent} from 'codegenNativeComponent'; +import type {HostComponent} from 'react-native'; type ModuleProps = $ReadOnly<{| ...ViewProps, @@ -290,7 +290,7 @@ type ModuleProps = $ReadOnly<{| export default (codegenNativeComponent( 'Module', -): NativeComponent); +): HostComponent); `; const ARRAY_PROP_TYPES_NO_EVENTS = ` @@ -312,7 +312,7 @@ import type {Int32, Double, Float, WithDefault} from 'CodegenTypes'; import type {ImageSource} from 'ImageSource'; import type {ColorValue, PointValue, EdgeInsetsValue} from 'StyleSheetTypes'; import type {ViewProps} from 'ViewPropTypes'; -import type {NativeComponent} from 'codegenNativeComponent'; +import type {HostComponent} from 'react-native'; type ObjectType = $ReadOnly<{| prop: string |}>; type ArrayObjectType = $ReadOnlyArray<$ReadOnly<{| prop: string |}>>; @@ -443,7 +443,7 @@ type ModuleProps = $ReadOnly<{| export default (codegenNativeComponent( 'Module', -): NativeComponent); +): HostComponent); `; const OBJECT_PROP_TYPES_NO_EVENTS = ` @@ -465,7 +465,7 @@ import type {Int32, Double, Float, WithDefault} from 'CodegenTypes'; import type {ImageSource} from 'ImageSource'; import type {ColorValue, PointValue, EdgeInsetsValue} from 'StyleSheetTypes'; import type {ViewProps} from 'ViewPropTypes'; -import type {NativeComponent} from 'codegenNativeComponent'; +import type {HostComponent} from 'react-native'; type ModuleProps = $ReadOnly<{| ...ViewProps, @@ -529,7 +529,7 @@ type ModuleProps = $ReadOnly<{| export default (codegenNativeComponent( 'Module', -): NativeComponent); +): HostComponent); `; const PROPS_ALIASED_LOCALLY = ` @@ -546,7 +546,7 @@ const PROPS_ALIASED_LOCALLY = ` 'use strict'; import type {ViewProps} from 'ViewPropTypes'; -import type {NativeComponent} from 'codegenNativeComponent'; +import type {HostComponent} from 'react-native'; const codegenNativeComponent = require('codegenNativeComponent'); @@ -574,7 +574,7 @@ export type ModuleProps = $ReadOnly<{| export default (codegenNativeComponent( 'Module', -): NativeComponent); +): HostComponent); `; const EVENTS_DEFINED_INLINE_WITH_ALL_TYPES = ` @@ -590,7 +590,7 @@ const EVENTS_DEFINED_INLINE_WITH_ALL_TYPES = ` 'use strict'; -import type {NativeComponent} from 'codegenNativeComponent'; +import type {HostComponent} from 'react-native'; const codegenNativeComponent = require('codegenNativeComponent'); import type { @@ -683,7 +683,7 @@ type ModuleProps = $ReadOnly<{| export default (codegenNativeComponent( 'Module', -): NativeComponent); +): HostComponent); `; const EVENTS_DEFINED_AS_NULL_INLINE = ` @@ -703,7 +703,7 @@ const codegenNativeComponent = require('codegenNativeComponent'); import type {BubblingEventHandler, DirectEventHandler} from 'CodegenTypese'; import type {ViewProps} from 'ViewPropTypes'; -import type {NativeComponent} from 'codegenNativeComponent'; +import type {HostComponent} from 'react-native'; type ModuleProps = $ReadOnly<{| ...ViewProps, @@ -732,7 +732,7 @@ type ModuleProps = $ReadOnly<{| export default (codegenNativeComponent( 'Module', -): NativeComponent); +): HostComponent); `; const PROPS_AND_EVENTS_TYPES_EXPORTED = ` @@ -753,7 +753,7 @@ import type { DirectEventHandler, } from 'CodegenTypes'; import type {ViewProps} from 'ViewPropTypes'; -import type {NativeComponent} from 'codegenNativeComponent'; +import type {HostComponent} from 'react-native'; const codegenNativeComponent = require('codegenNativeComponent'); @@ -775,7 +775,7 @@ export type ModuleProps = $ReadOnly<{| export default (codegenNativeComponent( 'Module', -): NativeComponent); +): HostComponent); `; const PROPS_AS_EXTERNAL_TYPES = ` @@ -793,7 +793,7 @@ const PROPS_AS_EXTERNAL_TYPES = ` const codegenNativeComponent = require('codegenNativeComponent'); -import type {NativeComponent} from 'codegenNativeComponent'; +import type {HostComponent} from 'react-native'; export type String = string; export type AnotherArray = $ReadOnlyArray; @@ -805,7 +805,7 @@ export type ModuleProps = $ReadOnly<{| export default (codegenNativeComponent( 'Module', -): NativeComponent); +): HostComponent); `; const COMMANDS_DEFINED_WITH_ALL_TYPES = ` @@ -826,7 +826,7 @@ const codegenNativeComponent = require('codegenNativeComponent'); import type {Int32, Double, Float} from 'CodegenTypes'; import type {ViewProps} from 'ViewPropTypes'; -import type {NativeComponent} from 'codegenNativeComponent'; +import type {HostComponent} from 'react-native'; export type ModuleProps = $ReadOnly<{| @@ -834,7 +834,7 @@ export type ModuleProps = $ReadOnly<{| // No props or events |}>; -type NativeType = NativeComponent; +type NativeType = HostComponent; interface NativeCommands { +hotspotUpdate: (viewRef: React.ElementRef, x: Int32, y: Int32) => void; @@ -874,7 +874,7 @@ const codegenNativeComponent = require('codegenNativeComponent'); import type {Int32} from 'CodegenTypes'; import type {ViewProps} from 'ViewPropTypes'; -import type {NativeComponent} from 'codegenNativeComponent'; +import type {HostComponent} from 'react-native'; export type Boolean = boolean; export type Int = Int32; @@ -885,7 +885,7 @@ export type ModuleProps = $ReadOnly<{| // No props or events |}>; -type NativeType = NativeComponent; +type NativeType = HostComponent; export type ScrollTo = ( viewRef: React.ElementRef, @@ -924,7 +924,7 @@ import type { DirectEventHandler, } from 'CodegenTypes'; import type {ViewProps} from 'ViewPropTypes'; -import type {NativeComponent} from 'codegenNativeComponent'; +import type {HostComponent} from 'react-native'; const codegenNativeComponent = require('codegenNativeComponent'); @@ -948,7 +948,7 @@ export type ModuleProps = $ReadOnly<{| onDirectEventDefinedInlineWithPaperName: DirectEventHandler, |}>; -type NativeType = NativeComponent; +type NativeType = HostComponent; export type ScrollTo = (viewRef: React.ElementRef, y: Int, animated: Boolean) => Void;