From 62da9b8ce2097c9037ee2c766c9d4cb64eae2930 Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Tue, 18 Oct 2022 10:30:06 -0700 Subject: [PATCH] Backout Generate Custom Native State from Codegen Summary: This is the second diffs that backs out the Custom Native State from the Codegen. The reason why we are backing it out are: 1. It forces users to create new types in JS that are not ctually used there. For example, the NativeState you define, and eventually exports, in JS is not used anywhere in your JS code. 2. You need to put in the JS native state some types that does not exists in JS, only to have them generated by the Codegen. ImageRequest, for example, does not exists in JS, but you need it in your (iOS) state to load images 3. There are a lot of edge cases due to how C++ handles variables. Some variables needs to be created as pointers. Some others as `const &`. It does not scale to hard code all of them and there is the risk to have the same type that needs to be a pointer in some case and something else in others. 4. It is better to instruct the users on how to properly create a component with Custom State, Shadow Node and Descriptor. ## Changelog: [General][Removed] - Back out parsing and generation of Custom Native State from Codegen Reviewed By: cortinico Differential Revision: D40426134 fbshipit-source-id: c368e122cc31ee8df056fe1bf6cecaab482140a4 --- .../react-native-codegen/src/CodegenSchema.js | 3 - .../components/ComponentsGeneratorUtils.js | 35 +- .../generators/components/GenerateStateCpp.js | 53 +- .../generators/components/GenerateStateH.js | 139 +- .../components/__test_fixtures__/fixtures.js | 905 -- .../GenerateComponentDescriptorH-test.js.snap | 420 - .../GenerateComponentHObjCpp-test.js.snap | 375 - .../GenerateEventEmitterCpp-test.js.snap | 375 - .../GenerateEventEmitterH-test.js.snap | 510 - .../GeneratePropsCpp-test.js.snap | 496 - .../__snapshots__/GeneratePropsH-test.js.snap | 541 - .../GeneratePropsJavaDelegate-test.js.snap | 472 - .../GeneratePropsJavaInterface-test.js.snap | 332 - .../GeneratePropsJavaPojo-test.js.snap | 365 - .../GenerateShadowNodeCpp-test.js.snap | 375 - .../GenerateShadowNodeH-test.js.snap | 600 - .../GenerateStateCpp-test.js.snap | 462 - .../__snapshots__/GenerateStateH-test.js.snap | 1233 +- .../__snapshots__/GenerateTests-test.js.snap | 539 - ...artyFabricComponentsProviderH-test.js.snap | 15 - ...abricComponentsProviderObjCpp-test.js.snap | 30 - .../GenerateViewConfigJs-test.js.snap | 470 - .../__tests__/checkComponentSnaps-test.js | 3 +- .../components/__test_fixtures__/failures.js | 408 - .../components/__test_fixtures__/fixtures.js | 512 +- .../component-parser-test.js.snap | 4714 ++----- .../src/parsers/flow/components/index.js | 39 +- .../src/parsers/flow/components/schema.js | 4 - .../src/parsers/flow/components/states.js | 60 - .../components/__test_fixtures__/failures.js | 315 - .../components/__test_fixtures__/fixtures.js | 603 +- .../typescript-component-parser-test.js.snap | 10602 ++++++---------- .../parsers/typescript/components/index.js | 40 +- .../parsers/typescript/components/schema.js | 4 - .../parsers/typescript/components/states.js | 57 - 35 files changed, 5323 insertions(+), 20783 deletions(-) delete mode 100644 packages/react-native-codegen/src/parsers/flow/components/states.js delete mode 100644 packages/react-native-codegen/src/parsers/typescript/components/states.js diff --git a/packages/react-native-codegen/src/CodegenSchema.js b/packages/react-native-codegen/src/CodegenSchema.js index f5f130002aa5d9..6884ca30710ba4 100644 --- a/packages/react-native-codegen/src/CodegenSchema.js +++ b/packages/react-native-codegen/src/CodegenSchema.js @@ -80,7 +80,6 @@ export type ComponentShape = $ReadOnly<{ events: $ReadOnlyArray, props: $ReadOnlyArray>, commands: $ReadOnlyArray>, - state?: $ReadOnlyArray>, }>; export type OptionsShape = $ReadOnly<{ @@ -187,8 +186,6 @@ export type ReservedPropTypeAnnotation = $ReadOnly<{ | 'ImageRequestPrimitive', }>; -export type StateTypeAnnotation = PropTypeAnnotation; - export type CommandTypeAnnotation = FunctionTypeAnnotation< CommandParamTypeAnnotation, VoidTypeAnnotation, diff --git a/packages/react-native-codegen/src/generators/components/ComponentsGeneratorUtils.js b/packages/react-native-codegen/src/generators/components/ComponentsGeneratorUtils.js index 994a109ae4140e..5e6b6c9aeb3b69 100644 --- a/packages/react-native-codegen/src/generators/components/ComponentsGeneratorUtils.js +++ b/packages/react-native-codegen/src/generators/components/ComponentsGeneratorUtils.js @@ -10,11 +10,7 @@ 'use strict'; -import type { - NamedShape, - PropTypeAnnotation, - StateTypeAnnotation, -} from '../../CodegenSchema'; +import type {NamedShape, PropTypeAnnotation} from '../../CodegenSchema'; import type { StringTypeAnnotation, @@ -27,7 +23,6 @@ import type { } from '../../CodegenSchema'; const { - convertDefaultTypeToString, getCppTypeForAnnotation, getEnumMaskName, getEnumName, @@ -39,7 +34,6 @@ function getNativeTypeFromAnnotation( componentName: string, prop: | NamedShape - | NamedShape | { name: string, typeAnnotation: @@ -133,28 +127,6 @@ function getNativeTypeFromAnnotation( } } -function getStateConstituents( - componentName: string, - stateShape: NamedShape, -): { - name: string, - varName: string, - type: string, - defaultValue: $FlowFixMe, -} { - const name = stateShape.name; - const varName = `${name}_`; - const type = getNativeTypeFromAnnotation(componentName, stateShape, []); - const defaultValue = convertDefaultTypeToString(componentName, stateShape); - - return { - name, - varName, - type, - defaultValue, - }; -} - /// This function process some types if we need to customize them /// For example, the ImageSource and the reserved types could be trasformed into /// const address instead of using them as plain types. @@ -239,9 +211,7 @@ const convertVarValueToPointer = (type: string, value: string): string => { }; function getLocalImports( - properties: - | $ReadOnlyArray> - | $ReadOnlyArray>, + properties: $ReadOnlyArray>, ): Set { const imports: Set = new Set(); @@ -325,7 +295,6 @@ function getLocalImports( module.exports = { getNativeTypeFromAnnotation, - getStateConstituents, convertCtorParamToAddressType, convertGettersReturnTypeToAddressType, convertCtorInitToSharedPointers, diff --git a/packages/react-native-codegen/src/generators/components/GenerateStateCpp.js b/packages/react-native-codegen/src/generators/components/GenerateStateCpp.js index 2e8a1843c0d630..d40fc1303061b6 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateStateCpp.js +++ b/packages/react-native-codegen/src/generators/components/GenerateStateCpp.js @@ -10,27 +10,17 @@ 'use strict'; -import type { - NamedShape, - SchemaType, - StateTypeAnnotation, -} from '../../CodegenSchema'; -const {capitalize} = require('../Utils.js'); -const { - getStateConstituents, - convertGettersReturnTypeToAddressType, - convertVarValueToPointer, -} = require('./ComponentsGeneratorUtils.js'); +import type {NamedShape, SchemaType} from '../../CodegenSchema'; // File path -> contents type FilesOutput = Map; const FileTemplate = ({ libraryName, - stateGetters, + stateClasses, }: { libraryName: string, - stateGetters: string, + stateClasses: string, }) => ` /** * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). @@ -45,34 +35,13 @@ const FileTemplate = ({ namespace facebook { namespace react { -${stateGetters} +${stateClasses} } // namespace react } // namespace facebook `; -function generateStrings( - componentName: string, - state: $ReadOnlyArray>, -) { - let getters = ''; - state.forEach(stateShape => { - const {name, varName, type} = getStateConstituents( - componentName, - stateShape, - ); - - getters += ` -${convertGettersReturnTypeToAddressType( - type, -)} ${componentName}State::get${capitalize(name)}() const { - return ${convertVarValueToPointer(type, varName)}; -} -`; - }); - - return getters.trim(); -} +const StateTemplate = ({stateName}: {stateName: string}) => ''; module.exports = { generate( @@ -83,7 +52,7 @@ module.exports = { ): FilesOutput { const fileName = 'States.cpp'; - const stateGetters = Object.keys(schema.modules) + const stateClasses = Object.keys(schema.modules) .map(moduleName => { const module = schema.modules[moduleName]; if (module.type !== 'Component') { @@ -103,11 +72,9 @@ module.exports = { return null; } - const state = component.state; - if (!state) { - return ''; - } - return generateStrings(componentName, state); + return StateTemplate({ + stateName: `${componentName}State`, + }); }) .filter(Boolean) .join('\n'); @@ -117,7 +84,7 @@ module.exports = { const replacedTemplate = FileTemplate({ libraryName, - stateGetters, + stateClasses, }); return new Map([[fileName, replacedTemplate]]); diff --git a/packages/react-native-codegen/src/generators/components/GenerateStateH.js b/packages/react-native-codegen/src/generators/components/GenerateStateH.js index 355dfdf995e7ee..658142eaea04eb 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateStateH.js +++ b/packages/react-native-codegen/src/generators/components/GenerateStateH.js @@ -10,31 +10,16 @@ 'use strict'; -import type { - NamedShape, - SchemaType, - StateTypeAnnotation, -} from '../../CodegenSchema'; -const {capitalize} = require('../Utils.js'); -const { - getStateConstituents, - convertCtorParamToAddressType, - convertGettersReturnTypeToAddressType, - convertCtorInitToSharedPointers, - convertVarTypeToSharedPointer, - getLocalImports, -} = require('./ComponentsGeneratorUtils.js'); +import type {SchemaType} from '../../CodegenSchema'; // File path -> contents type FilesOutput = Map; const FileTemplate = ({ libraryName, - imports, stateClasses, }: { libraryName: string, - imports: string, stateClasses: string, }) => ` @@ -48,16 +33,12 @@ const FileTemplate = ({ */ #pragma once -#include - #ifdef ANDROID #include #include #include #endif -${imports} - namespace facebook { namespace react { @@ -67,34 +48,12 @@ ${stateClasses} } // namespace facebook `.trim(); -const StateTemplate = ({ - stateName, - ctorParams, - ctorInits, - getters, - stateProps, -}: { - stateName: string, - ctorParams: string, - ctorInits: string, - getters: string, - stateProps: string, -}) => { - let stateWithParams = ''; - if (ctorParams.length > 0) { - stateWithParams = `${stateName}State( - ${ctorParams}) - : ${ctorInits}{};`; - } - - return ` +const StateTemplate = ({stateName}: {stateName: string}) => + ` class ${stateName}State { public: - ${stateWithParams} ${stateName}State() = default; - ${getters} - #ifdef ANDROID ${stateName}State(${stateName}State const &previousState, folly::dynamic data){}; folly::dynamic getDynamic() const { @@ -104,68 +63,8 @@ public: return MapBufferBuilder::EMPTY(); }; #endif - -private: - ${stateProps} }; `.trim(); -}; - -function sanitize(stringToSanitize: string, endString: string) { - if (stringToSanitize.endsWith(endString)) { - return stringToSanitize.slice(0, -1 * endString.length); - } - return stringToSanitize; -} - -function generateStrings( - componentName: string, - state: $ReadOnlyArray>, -): { - ctorParams: string, - ctorInits: string, - getters: string, - stateProps: string, -} { - let ctorParams = ''; - let ctorInits = ''; - let getters = ''; - let stateProps = ''; - - state.forEach(stateShape => { - const {name, varName, type, defaultValue} = getStateConstituents( - componentName, - stateShape, - ); - - ctorParams += `${convertCtorParamToAddressType(type)} ${name},\n `; - ctorInits += `${varName}(${convertCtorInitToSharedPointers( - type, - name, - )}),\n `; - getters += `${convertGettersReturnTypeToAddressType(type)} get${capitalize( - name, - )}() const;\n `; - let finalDefaultValue = defaultValue; - if (defaultValue.length > 0) { - finalDefaultValue = `{${defaultValue}}`; - } - stateProps += ` ${convertVarTypeToSharedPointer( - type, - )} ${varName}${finalDefaultValue};\n `; - }); - - // Sanitize - ctorParams = sanitize(ctorParams.trim(), ','); - ctorInits = sanitize(ctorInits.trim(), ','); - - return { - ctorParams, - ctorInits, - getters, - stateProps, - }; -} module.exports = { generate( @@ -176,8 +75,6 @@ module.exports = { ): FilesOutput { const fileName = 'States.h'; - const allImports: Set = new Set(); - const stateClasses = Object.keys(schema.modules) .map(moduleName => { const module = schema.modules[moduleName]; @@ -190,39 +87,14 @@ module.exports = { if (components == null) { return null; } + return Object.keys(components) .map(componentName => { const component = components[componentName]; if (component.interfaceOnly === true) { return null; } - - const state = component.state; - if (!state) { - return StateTemplate({ - stateName: componentName, - ctorParams: '', - ctorInits: '', - getters: '', - stateProps: '', - }); - } - - const {ctorParams, ctorInits, getters, stateProps} = - generateStrings(componentName, state); - - const imports = getLocalImports(state); - - // $FlowFixMe[method-unbinding] added when improving typing for this parameters - imports.forEach(allImports.add, allImports); - - return StateTemplate({ - stateName: componentName, - ctorParams, - ctorInits, - getters, - stateProps, - }); + return StateTemplate({stateName: componentName}); }) .filter(Boolean) .join('\n\n'); @@ -232,7 +104,6 @@ module.exports = { const template = FileTemplate({ libraryName, - imports: Array.from(allImports).sort().join('\n'), stateClasses, }); return new Map([[fileName, template]]); diff --git a/packages/react-native-codegen/src/generators/components/__test_fixtures__/fixtures.js b/packages/react-native-codegen/src/generators/components/__test_fixtures__/fixtures.js index 77d3060d58297e..b38d07d189e61f 100644 --- a/packages/react-native-codegen/src/generators/components/__test_fixtures__/fixtures.js +++ b/packages/react-native-codegen/src/generators/components/__test_fixtures__/fixtures.js @@ -1641,896 +1641,6 @@ const EXCLUDE_IOS_TWO_COMPONENTS_DIFFERENT_FILES: SchemaType = { }, }; -const COMPONENT_WITH_BOOL_STATE: SchemaType = { - modules: { - MyComponent: { - type: 'Component', - components: { - SimpleComponent: { - extendsProps: [ - { - type: 'ReactNativeBuiltInType', - knownTypeName: 'ReactNativeCoreViewProps', - }, - ], - events: [], - props: [], - commands: [], - state: [ - { - name: 'disabled', - optional: false, - typeAnnotation: { - type: 'BooleanTypeAnnotation', - default: false, - }, - }, - ], - }, - }, - }, - }, -}; - -const COMPONENT_WITH_STRING_STATE: SchemaType = { - modules: { - MyComponent: { - type: 'Component', - components: { - SimpleComponent: { - extendsProps: [ - { - type: 'ReactNativeBuiltInType', - knownTypeName: 'ReactNativeCoreViewProps', - }, - ], - events: [], - props: [], - commands: [], - state: [ - { - name: 'accessibilityHint', - optional: true, - typeAnnotation: { - type: 'StringTypeAnnotation', - default: '', - }, - }, - { - name: 'accessibilityRole', - optional: true, - typeAnnotation: { - type: 'StringTypeAnnotation', - default: null, - }, - }, - ], - }, - }, - }, - }, -}; - -const COMPONENT_WITH_INT_STATE: SchemaType = { - modules: { - MyComponent: { - type: 'Component', - components: { - SimpleComponent: { - extendsProps: [ - { - type: 'ReactNativeBuiltInType', - knownTypeName: 'ReactNativeCoreViewProps', - }, - ], - events: [], - props: [], - commands: [], - state: [ - { - name: 'progress1', - optional: true, - typeAnnotation: { - type: 'Int32TypeAnnotation', - default: 0, - }, - }, - { - name: 'progress2', - optional: true, - typeAnnotation: { - type: 'Int32TypeAnnotation', - default: -1, - }, - }, - { - name: 'progress3', - optional: true, - typeAnnotation: { - type: 'Int32TypeAnnotation', - default: 10, - }, - }, - ], - }, - }, - }, - }, -}; - -const COMPONENT_WITH_FLOAT_STATE: SchemaType = { - modules: { - MyComponent: { - type: 'Component', - components: { - SimpleComponent: { - extendsProps: [ - { - type: 'ReactNativeBuiltInType', - knownTypeName: 'ReactNativeCoreViewProps', - }, - ], - events: [], - props: [], - commands: [], - state: [ - { - name: 'blurRadius', - optional: false, - typeAnnotation: { - type: 'FloatTypeAnnotation', - default: 0.0, - }, - }, - { - name: 'blurRadius2', - optional: true, - typeAnnotation: { - type: 'FloatTypeAnnotation', - default: 7.5, - }, - }, - { - name: 'blurRadius3', - optional: true, - typeAnnotation: { - type: 'FloatTypeAnnotation', - default: -2.1, - }, - }, - ], - }, - }, - }, - }, -}; - -const COMPONENT_WITH_DOUBLE_STATE: SchemaType = { - modules: { - MyComponent: { - type: 'Component', - components: { - SimpleComponent: { - extendsProps: [ - { - type: 'ReactNativeBuiltInType', - knownTypeName: 'ReactNativeCoreViewProps', - }, - ], - events: [], - props: [], - commands: [], - state: [ - { - name: 'd_blurRadius', - optional: false, - typeAnnotation: { - type: 'DoubleTypeAnnotation', - default: 0.0, - }, - }, - { - name: 'd_blurRadius2', - optional: true, - typeAnnotation: { - type: 'DoubleTypeAnnotation', - default: 8.9, - }, - }, - { - name: 'd_blurRadius3', - optional: true, - typeAnnotation: { - type: 'DoubleTypeAnnotation', - default: -0.5, - }, - }, - ], - }, - }, - }, - }, -}; - -const COMPONENT_WITH_COLOR_STATE: SchemaType = { - modules: { - MyComponent: { - type: 'Component', - components: { - SimpleComponent: { - extendsProps: [ - { - type: 'ReactNativeBuiltInType', - knownTypeName: 'ReactNativeCoreViewProps', - }, - ], - events: [], - props: [], - commands: [], - state: [ - { - name: 'tintColor', - optional: true, - typeAnnotation: { - type: 'ReservedPropTypeAnnotation', - name: 'ColorPrimitive', - }, - }, - ], - }, - }, - }, - }, -}; - -const COMPONENT_WITH_IMAGE_STATE: SchemaType = { - modules: { - MyComponent: { - type: 'Component', - components: { - SimpleComponent: { - extendsProps: [ - { - type: 'ReactNativeBuiltInType', - knownTypeName: 'ReactNativeCoreViewProps', - }, - ], - events: [], - props: [], - commands: [], - state: [ - { - name: 'thumbImage', - optional: true, - typeAnnotation: { - type: 'ReservedPropTypeAnnotation', - name: 'ImageSourcePrimitive', - }, - }, - ], - }, - }, - }, - }, -}; - -const COMPONENT_WITH_POINT_STATE: SchemaType = { - modules: { - MyComponent: { - type: 'Component', - components: { - SimpleComponent: { - extendsProps: [ - { - type: 'ReactNativeBuiltInType', - knownTypeName: 'ReactNativeCoreViewProps', - }, - ], - events: [], - props: [], - commands: [], - state: [ - { - name: 'startPoint', - optional: true, - typeAnnotation: { - type: 'ReservedPropTypeAnnotation', - name: 'PointPrimitive', - }, - }, - ], - }, - }, - }, - }, -}; - -const COMPONENT_WITH_EDGE_INSET_STATE_PROPS: SchemaType = { - modules: { - MyComponent: { - type: 'Component', - components: { - SimpleComponent: { - extendsProps: [ - { - type: 'ReactNativeBuiltInType', - knownTypeName: 'ReactNativeCoreViewProps', - }, - ], - events: [], - props: [], - commands: [], - state: [ - { - name: 'contentInset', - optional: true, - typeAnnotation: { - type: 'ReservedPropTypeAnnotation', - name: 'EdgeInsetsPrimitive', - }, - }, - ], - }, - }, - }, - }, -}; - -const COMPONENT_WITH_ARRAY_OF_OBJECTS_STATE: SchemaType = { - modules: { - MyComponent: { - type: 'Component', - components: { - SimpleComponent: { - extendsProps: [ - { - type: 'ReactNativeBuiltInType', - knownTypeName: 'ReactNativeCoreViewProps', - }, - ], - events: [], - props: [], - commands: [], - state: [ - { - name: 'arrayState', - optional: true, - typeAnnotation: { - type: 'ArrayTypeAnnotation', - elementType: { - type: 'ObjectTypeAnnotation', - properties: [ - { - name: 'colors', - optional: true, - typeAnnotation: { - type: 'ArrayTypeAnnotation', - elementType: { - type: 'ReservedPropTypeAnnotation', - name: 'ColorPrimitive', - }, - }, - }, - { - name: 'srcs', - optional: true, - typeAnnotation: { - type: 'ArrayTypeAnnotation', - elementType: { - type: 'ReservedPropTypeAnnotation', - name: 'ImageSourcePrimitive', - }, - }, - }, - { - name: 'points', - optional: true, - typeAnnotation: { - type: 'ArrayTypeAnnotation', - elementType: { - type: 'ReservedPropTypeAnnotation', - name: 'PointPrimitive', - }, - }, - }, - ], - }, - }, - }, - ], - }, - }, - }, - }, -}; - -const COMPONENT_WITH_ARRAY_STATE: SchemaType = { - modules: { - MyComponent: { - type: 'Component', - components: { - SimpleComponent: { - extendsProps: [ - { - type: 'ReactNativeBuiltInType', - knownTypeName: 'ReactNativeCoreViewProps', - }, - ], - events: [], - props: [], - commands: [], - state: [ - { - name: 'names', - optional: true, - typeAnnotation: { - type: 'ArrayTypeAnnotation', - elementType: { - type: 'StringTypeAnnotation', - }, - }, - }, - { - name: 'disableds', - optional: true, - typeAnnotation: { - type: 'ArrayTypeAnnotation', - elementType: { - type: 'BooleanTypeAnnotation', - }, - }, - }, - { - name: 'progress', - optional: true, - typeAnnotation: { - type: 'ArrayTypeAnnotation', - elementType: { - type: 'Int32TypeAnnotation', - }, - }, - }, - { - name: 'radii', - optional: true, - typeAnnotation: { - type: 'ArrayTypeAnnotation', - elementType: { - type: 'FloatTypeAnnotation', - }, - }, - }, - { - name: 'colors', - optional: true, - typeAnnotation: { - type: 'ArrayTypeAnnotation', - elementType: { - type: 'ReservedPropTypeAnnotation', - name: 'ColorPrimitive', - }, - }, - }, - { - name: 'srcs', - optional: true, - typeAnnotation: { - type: 'ArrayTypeAnnotation', - elementType: { - type: 'ReservedPropTypeAnnotation', - name: 'ImageSourcePrimitive', - }, - }, - }, - { - name: 'points', - optional: true, - typeAnnotation: { - type: 'ArrayTypeAnnotation', - elementType: { - type: 'ReservedPropTypeAnnotation', - name: 'PointPrimitive', - }, - }, - }, - { - name: 'sizes', - optional: true, - typeAnnotation: { - type: 'ArrayTypeAnnotation', - elementType: { - type: 'StringEnumTypeAnnotation', - default: 'small', - options: ['small', 'large'], - }, - }, - }, - { - name: 'object', - optional: true, - typeAnnotation: { - type: 'ArrayTypeAnnotation', - elementType: { - type: 'ObjectTypeAnnotation', - properties: [ - { - name: 'stringProp', - optional: true, - typeAnnotation: { - type: 'StringTypeAnnotation', - default: '', - }, - }, - ], - }, - }, - }, - { - name: 'array', - optional: true, - typeAnnotation: { - type: 'ArrayTypeAnnotation', - elementType: { - type: 'ObjectTypeAnnotation', - properties: [ - { - // This needs to stay the same as the object above - // to confirm that the structs are generated - // with unique non-colliding names - name: 'object', - optional: true, - typeAnnotation: { - type: 'ArrayTypeAnnotation', - elementType: { - type: 'ObjectTypeAnnotation', - properties: [ - { - name: 'stringProp', - optional: true, - typeAnnotation: { - type: 'StringTypeAnnotation', - default: '', - }, - }, - ], - }, - }, - }, - ], - }, - }, - }, - { - name: 'arrayOfArrayOfObject', - optional: true, - typeAnnotation: { - type: 'ArrayTypeAnnotation', - elementType: { - type: 'ArrayTypeAnnotation', - elementType: { - type: 'ObjectTypeAnnotation', - properties: [ - { - name: 'stringProp', - optional: true, - typeAnnotation: { - type: 'StringTypeAnnotation', - default: '', - }, - }, - ], - }, - }, - }, - }, - ], - }, - }, - }, - }, -}; - -const COMPONENT_WITH_OBJECT_STATE: SchemaType = { - modules: { - MyComponent: { - type: 'Component', - components: { - SimpleComponent: { - extendsProps: [ - { - type: 'ReactNativeBuiltInType', - knownTypeName: 'ReactNativeCoreViewProps', - }, - ], - events: [], - props: [], - commands: [], - state: [ - { - name: 'objectProp', - optional: true, - typeAnnotation: { - type: 'ObjectTypeAnnotation', - properties: [ - { - name: 'stringProp', - optional: true, - typeAnnotation: { - type: 'StringTypeAnnotation', - default: '', - }, - }, - { - name: 'booleanProp', - optional: true, - typeAnnotation: { - type: 'BooleanTypeAnnotation', - default: false, - }, - }, - { - name: 'floatProp', - optional: true, - typeAnnotation: { - type: 'FloatTypeAnnotation', - default: 0.0, - }, - }, - { - name: 'intProp', - optional: true, - typeAnnotation: { - type: 'Int32TypeAnnotation', - default: 0, - }, - }, - { - name: 'stringEnumProp', - optional: true, - typeAnnotation: { - type: 'StringEnumTypeAnnotation', - default: 'option1', - options: ['option1'], - }, - }, - { - name: 'intEnumProp', - optional: true, - typeAnnotation: { - type: 'Int32EnumTypeAnnotation', - default: 0, - options: [0], - }, - }, - { - name: 'objectArrayProp', - optional: false, - typeAnnotation: { - type: 'ObjectTypeAnnotation', - properties: [ - { - name: 'array', - optional: true, - typeAnnotation: { - type: 'ArrayTypeAnnotation', - elementType: { - type: 'StringTypeAnnotation', - }, - }, - }, - ], - }, - }, - { - name: 'objectPrimitiveRequiredProp', - optional: false, - typeAnnotation: { - type: 'ObjectTypeAnnotation', - properties: [ - { - name: 'image', - optional: true, - typeAnnotation: { - type: 'ReservedPropTypeAnnotation', - name: 'ImageSourcePrimitive', - }, - }, - { - name: 'color', - optional: true, - typeAnnotation: { - type: 'ReservedPropTypeAnnotation', - name: 'ColorPrimitive', - }, - }, - { - name: 'point', - optional: true, - typeAnnotation: { - type: 'ReservedPropTypeAnnotation', - name: 'PointPrimitive', - }, - }, - ], - }, - }, - { - name: 'nestedPropA', - optional: false, - typeAnnotation: { - type: 'ObjectTypeAnnotation', - properties: [ - { - name: 'nestedPropB', - optional: false, - typeAnnotation: { - type: 'ObjectTypeAnnotation', - properties: [ - { - name: 'nestedPropC', - optional: true, - typeAnnotation: { - type: 'StringTypeAnnotation', - default: '', - }, - }, - ], - }, - }, - ], - }, - }, - { - name: 'nestedArrayAsProperty', - optional: false, - typeAnnotation: { - type: 'ObjectTypeAnnotation', - properties: [ - { - name: 'arrayProp', - optional: false, - typeAnnotation: { - type: 'ArrayTypeAnnotation', - elementType: { - type: 'ObjectTypeAnnotation', - properties: [ - { - name: 'stringProp', - optional: false, - typeAnnotation: { - type: 'StringTypeAnnotation', - default: '', - }, - }, - ], - }, - }, - }, - ], - }, - }, - ], - }, - }, - ], - }, - }, - }, - }, -}; - -const COMPONENT_WITH_STRING_ENUM_STATE_PROPS: SchemaType = { - modules: { - MyComponent: { - type: 'Component', - components: { - SimpleComponent: { - extendsProps: [ - { - type: 'ReactNativeBuiltInType', - knownTypeName: 'ReactNativeCoreViewProps', - }, - ], - events: [], - props: [], - commands: [], - state: [ - { - name: 'alignment', - optional: true, - typeAnnotation: { - type: 'StringEnumTypeAnnotation', - default: 'center', - options: ['top', 'center', 'bottom-right'], - }, - }, - ], - }, - }, - }, - }, -}; - -const COMPONENT_WITH_INT_ENUM_STATE: SchemaType = { - modules: { - MyComponent: { - type: 'Component', - components: { - SimpleComponent: { - extendsProps: [ - { - type: 'ReactNativeBuiltInType', - knownTypeName: 'ReactNativeCoreViewProps', - }, - ], - events: [], - props: [], - commands: [], - state: [ - { - name: 'maxInterval', - optional: true, - typeAnnotation: { - type: 'Int32EnumTypeAnnotation', - default: 0, - options: [0, 1, 2], - }, - }, - ], - }, - }, - }, - }, -}; - -const COMPONENTS_WITH_IMAGES_IN_STATE: SchemaType = { - modules: { - MyComponent: { - type: 'Component', - components: { - SimpleComponent: { - extendsProps: [ - { - type: 'ReactNativeBuiltInType', - knownTypeName: 'ReactNativeCoreViewProps', - }, - ], - events: [], - props: [ - { - name: 'imageSource', - optional: false, - typeAnnotation: { - type: 'ReservedPropTypeAnnotation', - name: 'ImageSourcePrimitive', - }, - }, - ], - commands: [], - state: [ - { - name: 'imageSource', - optional: false, - typeAnnotation: { - type: 'ReservedPropTypeAnnotation', - name: 'ImageSourcePrimitive', - }, - }, - { - name: 'imageRequest', - optional: false, - typeAnnotation: { - type: 'ReservedPropTypeAnnotation', - name: 'ImageRequestPrimitive', - }, - }, - ], - }, - }, - }, - }, -}; - module.exports = { NO_PROPS_NO_EVENTS, INTERFACE_ONLY, @@ -2559,19 +1669,4 @@ module.exports = { EXCLUDE_ANDROID, EXCLUDE_ANDROID_IOS, EXCLUDE_IOS_TWO_COMPONENTS_DIFFERENT_FILES, - COMPONENT_WITH_BOOL_STATE, - COMPONENT_WITH_STRING_STATE, - COMPONENT_WITH_INT_STATE, - COMPONENT_WITH_FLOAT_STATE, - COMPONENT_WITH_DOUBLE_STATE, - COMPONENT_WITH_COLOR_STATE, - COMPONENT_WITH_POINT_STATE, - COMPONENT_WITH_IMAGE_STATE, - COMPONENT_WITH_EDGE_INSET_STATE_PROPS, - COMPONENT_WITH_ARRAY_STATE, - COMPONENT_WITH_OBJECT_STATE, - COMPONENT_WITH_ARRAY_OF_OBJECTS_STATE, - COMPONENT_WITH_STRING_ENUM_STATE_PROPS, - COMPONENT_WITH_INT_ENUM_STATE, - COMPONENTS_WITH_IMAGES_IN_STATE, }; diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateComponentDescriptorH-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateComponentDescriptorH-test.js.snap index cfd91b6c6edaf4..7cf29170dec8d4 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateComponentDescriptorH-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateComponentDescriptorH-test.js.snap @@ -168,426 +168,6 @@ using CommandNativeComponentComponentDescriptor = ConcreteComponentDescriptor " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateComponentDescriptorH.js - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -using SimpleComponentComponentDescriptor = ConcreteComponentDescriptor; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateComponentDescriptorH can generate fixture COMPONENT_WITH_ARRAY_STATE 1`] = ` -Map { - "ComponentDescriptors.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateComponentDescriptorH.js - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -using SimpleComponentComponentDescriptor = ConcreteComponentDescriptor; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateComponentDescriptorH can generate fixture COMPONENT_WITH_BOOL_STATE 1`] = ` -Map { - "ComponentDescriptors.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateComponentDescriptorH.js - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -using SimpleComponentComponentDescriptor = ConcreteComponentDescriptor; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateComponentDescriptorH can generate fixture COMPONENT_WITH_COLOR_STATE 1`] = ` -Map { - "ComponentDescriptors.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateComponentDescriptorH.js - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -using SimpleComponentComponentDescriptor = ConcreteComponentDescriptor; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateComponentDescriptorH can generate fixture COMPONENT_WITH_DOUBLE_STATE 1`] = ` -Map { - "ComponentDescriptors.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateComponentDescriptorH.js - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -using SimpleComponentComponentDescriptor = ConcreteComponentDescriptor; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateComponentDescriptorH can generate fixture COMPONENT_WITH_EDGE_INSET_STATE_PROPS 1`] = ` -Map { - "ComponentDescriptors.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateComponentDescriptorH.js - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -using SimpleComponentComponentDescriptor = ConcreteComponentDescriptor; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateComponentDescriptorH can generate fixture COMPONENT_WITH_FLOAT_STATE 1`] = ` -Map { - "ComponentDescriptors.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateComponentDescriptorH.js - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -using SimpleComponentComponentDescriptor = ConcreteComponentDescriptor; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateComponentDescriptorH can generate fixture COMPONENT_WITH_IMAGE_STATE 1`] = ` -Map { - "ComponentDescriptors.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateComponentDescriptorH.js - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -using SimpleComponentComponentDescriptor = ConcreteComponentDescriptor; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateComponentDescriptorH can generate fixture COMPONENT_WITH_INT_ENUM_STATE 1`] = ` -Map { - "ComponentDescriptors.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateComponentDescriptorH.js - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -using SimpleComponentComponentDescriptor = ConcreteComponentDescriptor; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateComponentDescriptorH can generate fixture COMPONENT_WITH_INT_STATE 1`] = ` -Map { - "ComponentDescriptors.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateComponentDescriptorH.js - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -using SimpleComponentComponentDescriptor = ConcreteComponentDescriptor; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateComponentDescriptorH can generate fixture COMPONENT_WITH_OBJECT_STATE 1`] = ` -Map { - "ComponentDescriptors.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateComponentDescriptorH.js - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -using SimpleComponentComponentDescriptor = ConcreteComponentDescriptor; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateComponentDescriptorH can generate fixture COMPONENT_WITH_POINT_STATE 1`] = ` -Map { - "ComponentDescriptors.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateComponentDescriptorH.js - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -using SimpleComponentComponentDescriptor = ConcreteComponentDescriptor; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateComponentDescriptorH can generate fixture COMPONENT_WITH_STRING_ENUM_STATE_PROPS 1`] = ` -Map { - "ComponentDescriptors.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateComponentDescriptorH.js - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -using SimpleComponentComponentDescriptor = ConcreteComponentDescriptor; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateComponentDescriptorH can generate fixture COMPONENT_WITH_STRING_STATE 1`] = ` -Map { - "ComponentDescriptors.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateComponentDescriptorH.js - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -using SimpleComponentComponentDescriptor = ConcreteComponentDescriptor; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateComponentDescriptorH can generate fixture COMPONENTS_WITH_IMAGES_IN_STATE 1`] = ` -Map { - "ComponentDescriptors.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateComponentDescriptorH.js - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -using SimpleComponentComponentDescriptor = ConcreteComponentDescriptor; - -} // namespace react -} // namespace facebook -", -} -`; - exports[`GenerateComponentDescriptorH can generate fixture DOUBLE_PROPS 1`] = ` Map { "ComponentDescriptors.h" => " diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateComponentHObjCpp-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateComponentHObjCpp-test.js.snap index df6660fa8c3782..f7b45e6fc31e0f 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateComponentHObjCpp-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateComponentHObjCpp-test.js.snap @@ -286,381 +286,6 @@ NS_ASSUME_NONNULL_END", } `; -exports[`GenerateComponentHObjCpp can generate fixture COMPONENT_WITH_ARRAY_OF_OBJECTS_STATE 1`] = ` -Map { - "RCTComponentViewHelpers.h" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GenerateComponentHObjCpp.js -*/ - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol RCTSimpleComponentViewProtocol - -@end - -NS_ASSUME_NONNULL_END", -} -`; - -exports[`GenerateComponentHObjCpp can generate fixture COMPONENT_WITH_ARRAY_STATE 1`] = ` -Map { - "RCTComponentViewHelpers.h" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GenerateComponentHObjCpp.js -*/ - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol RCTSimpleComponentViewProtocol - -@end - -NS_ASSUME_NONNULL_END", -} -`; - -exports[`GenerateComponentHObjCpp can generate fixture COMPONENT_WITH_BOOL_STATE 1`] = ` -Map { - "RCTComponentViewHelpers.h" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GenerateComponentHObjCpp.js -*/ - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol RCTSimpleComponentViewProtocol - -@end - -NS_ASSUME_NONNULL_END", -} -`; - -exports[`GenerateComponentHObjCpp can generate fixture COMPONENT_WITH_COLOR_STATE 1`] = ` -Map { - "RCTComponentViewHelpers.h" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GenerateComponentHObjCpp.js -*/ - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol RCTSimpleComponentViewProtocol - -@end - -NS_ASSUME_NONNULL_END", -} -`; - -exports[`GenerateComponentHObjCpp can generate fixture COMPONENT_WITH_DOUBLE_STATE 1`] = ` -Map { - "RCTComponentViewHelpers.h" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GenerateComponentHObjCpp.js -*/ - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol RCTSimpleComponentViewProtocol - -@end - -NS_ASSUME_NONNULL_END", -} -`; - -exports[`GenerateComponentHObjCpp can generate fixture COMPONENT_WITH_EDGE_INSET_STATE_PROPS 1`] = ` -Map { - "RCTComponentViewHelpers.h" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GenerateComponentHObjCpp.js -*/ - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol RCTSimpleComponentViewProtocol - -@end - -NS_ASSUME_NONNULL_END", -} -`; - -exports[`GenerateComponentHObjCpp can generate fixture COMPONENT_WITH_FLOAT_STATE 1`] = ` -Map { - "RCTComponentViewHelpers.h" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GenerateComponentHObjCpp.js -*/ - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol RCTSimpleComponentViewProtocol - -@end - -NS_ASSUME_NONNULL_END", -} -`; - -exports[`GenerateComponentHObjCpp can generate fixture COMPONENT_WITH_IMAGE_STATE 1`] = ` -Map { - "RCTComponentViewHelpers.h" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GenerateComponentHObjCpp.js -*/ - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol RCTSimpleComponentViewProtocol - -@end - -NS_ASSUME_NONNULL_END", -} -`; - -exports[`GenerateComponentHObjCpp can generate fixture COMPONENT_WITH_INT_ENUM_STATE 1`] = ` -Map { - "RCTComponentViewHelpers.h" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GenerateComponentHObjCpp.js -*/ - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol RCTSimpleComponentViewProtocol - -@end - -NS_ASSUME_NONNULL_END", -} -`; - -exports[`GenerateComponentHObjCpp can generate fixture COMPONENT_WITH_INT_STATE 1`] = ` -Map { - "RCTComponentViewHelpers.h" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GenerateComponentHObjCpp.js -*/ - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol RCTSimpleComponentViewProtocol - -@end - -NS_ASSUME_NONNULL_END", -} -`; - -exports[`GenerateComponentHObjCpp can generate fixture COMPONENT_WITH_OBJECT_STATE 1`] = ` -Map { - "RCTComponentViewHelpers.h" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GenerateComponentHObjCpp.js -*/ - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol RCTSimpleComponentViewProtocol - -@end - -NS_ASSUME_NONNULL_END", -} -`; - -exports[`GenerateComponentHObjCpp can generate fixture COMPONENT_WITH_POINT_STATE 1`] = ` -Map { - "RCTComponentViewHelpers.h" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GenerateComponentHObjCpp.js -*/ - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol RCTSimpleComponentViewProtocol - -@end - -NS_ASSUME_NONNULL_END", -} -`; - -exports[`GenerateComponentHObjCpp can generate fixture COMPONENT_WITH_STRING_ENUM_STATE_PROPS 1`] = ` -Map { - "RCTComponentViewHelpers.h" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GenerateComponentHObjCpp.js -*/ - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol RCTSimpleComponentViewProtocol - -@end - -NS_ASSUME_NONNULL_END", -} -`; - -exports[`GenerateComponentHObjCpp can generate fixture COMPONENT_WITH_STRING_STATE 1`] = ` -Map { - "RCTComponentViewHelpers.h" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GenerateComponentHObjCpp.js -*/ - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol RCTSimpleComponentViewProtocol - -@end - -NS_ASSUME_NONNULL_END", -} -`; - -exports[`GenerateComponentHObjCpp can generate fixture COMPONENTS_WITH_IMAGES_IN_STATE 1`] = ` -Map { - "RCTComponentViewHelpers.h" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GenerateComponentHObjCpp.js -*/ - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol RCTSimpleComponentViewProtocol - -@end - -NS_ASSUME_NONNULL_END", -} -`; - exports[`GenerateComponentHObjCpp can generate fixture DOUBLE_PROPS 1`] = ` Map { "RCTComponentViewHelpers.h" => "/** diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateEventEmitterCpp-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateEventEmitterCpp-test.js.snap index b89cfa6c126c0a..9c58425980fe21 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateEventEmitterCpp-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateEventEmitterCpp-test.js.snap @@ -144,381 +144,6 @@ namespace react { -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateEventEmitterCpp can generate fixture COMPONENT_WITH_ARRAY_OF_OBJECTS_STATE 1`] = ` -Map { - "EventEmitters.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateEventEmitterCpp.js - */ - -#include - -namespace facebook { -namespace react { - - - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateEventEmitterCpp can generate fixture COMPONENT_WITH_ARRAY_STATE 1`] = ` -Map { - "EventEmitters.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateEventEmitterCpp.js - */ - -#include - -namespace facebook { -namespace react { - - - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateEventEmitterCpp can generate fixture COMPONENT_WITH_BOOL_STATE 1`] = ` -Map { - "EventEmitters.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateEventEmitterCpp.js - */ - -#include - -namespace facebook { -namespace react { - - - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateEventEmitterCpp can generate fixture COMPONENT_WITH_COLOR_STATE 1`] = ` -Map { - "EventEmitters.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateEventEmitterCpp.js - */ - -#include - -namespace facebook { -namespace react { - - - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateEventEmitterCpp can generate fixture COMPONENT_WITH_DOUBLE_STATE 1`] = ` -Map { - "EventEmitters.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateEventEmitterCpp.js - */ - -#include - -namespace facebook { -namespace react { - - - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateEventEmitterCpp can generate fixture COMPONENT_WITH_EDGE_INSET_STATE_PROPS 1`] = ` -Map { - "EventEmitters.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateEventEmitterCpp.js - */ - -#include - -namespace facebook { -namespace react { - - - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateEventEmitterCpp can generate fixture COMPONENT_WITH_FLOAT_STATE 1`] = ` -Map { - "EventEmitters.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateEventEmitterCpp.js - */ - -#include - -namespace facebook { -namespace react { - - - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateEventEmitterCpp can generate fixture COMPONENT_WITH_IMAGE_STATE 1`] = ` -Map { - "EventEmitters.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateEventEmitterCpp.js - */ - -#include - -namespace facebook { -namespace react { - - - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateEventEmitterCpp can generate fixture COMPONENT_WITH_INT_ENUM_STATE 1`] = ` -Map { - "EventEmitters.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateEventEmitterCpp.js - */ - -#include - -namespace facebook { -namespace react { - - - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateEventEmitterCpp can generate fixture COMPONENT_WITH_INT_STATE 1`] = ` -Map { - "EventEmitters.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateEventEmitterCpp.js - */ - -#include - -namespace facebook { -namespace react { - - - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateEventEmitterCpp can generate fixture COMPONENT_WITH_OBJECT_STATE 1`] = ` -Map { - "EventEmitters.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateEventEmitterCpp.js - */ - -#include - -namespace facebook { -namespace react { - - - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateEventEmitterCpp can generate fixture COMPONENT_WITH_POINT_STATE 1`] = ` -Map { - "EventEmitters.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateEventEmitterCpp.js - */ - -#include - -namespace facebook { -namespace react { - - - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateEventEmitterCpp can generate fixture COMPONENT_WITH_STRING_ENUM_STATE_PROPS 1`] = ` -Map { - "EventEmitters.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateEventEmitterCpp.js - */ - -#include - -namespace facebook { -namespace react { - - - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateEventEmitterCpp can generate fixture COMPONENT_WITH_STRING_STATE 1`] = ` -Map { - "EventEmitters.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateEventEmitterCpp.js - */ - -#include - -namespace facebook { -namespace react { - - - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateEventEmitterCpp can generate fixture COMPONENTS_WITH_IMAGES_IN_STATE 1`] = ` -Map { - "EventEmitters.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateEventEmitterCpp.js - */ - -#include - -namespace facebook { -namespace react { - - - } // namespace react } // namespace facebook ", diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateEventEmitterH-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateEventEmitterH-test.js.snap index 8255d75631cc2b..fffed704338474 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateEventEmitterH-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateEventEmitterH-test.js.snap @@ -196,516 +196,6 @@ class JSI_EXPORT CommandNativeComponentEventEmitter : public ViewEventEmitter { -}; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateEventEmitterH can generate fixture COMPONENT_WITH_ARRAY_OF_OBJECTS_STATE 1`] = ` -Map { - "EventEmitters.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateEventEmitterH.js - */ -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -class JSI_EXPORT SimpleComponentEventEmitter : public ViewEventEmitter { - public: - using ViewEventEmitter::ViewEventEmitter; - - - - -}; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateEventEmitterH can generate fixture COMPONENT_WITH_ARRAY_STATE 1`] = ` -Map { - "EventEmitters.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateEventEmitterH.js - */ -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -class JSI_EXPORT SimpleComponentEventEmitter : public ViewEventEmitter { - public: - using ViewEventEmitter::ViewEventEmitter; - - - - -}; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateEventEmitterH can generate fixture COMPONENT_WITH_BOOL_STATE 1`] = ` -Map { - "EventEmitters.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateEventEmitterH.js - */ -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -class JSI_EXPORT SimpleComponentEventEmitter : public ViewEventEmitter { - public: - using ViewEventEmitter::ViewEventEmitter; - - - - -}; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateEventEmitterH can generate fixture COMPONENT_WITH_COLOR_STATE 1`] = ` -Map { - "EventEmitters.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateEventEmitterH.js - */ -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -class JSI_EXPORT SimpleComponentEventEmitter : public ViewEventEmitter { - public: - using ViewEventEmitter::ViewEventEmitter; - - - - -}; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateEventEmitterH can generate fixture COMPONENT_WITH_DOUBLE_STATE 1`] = ` -Map { - "EventEmitters.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateEventEmitterH.js - */ -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -class JSI_EXPORT SimpleComponentEventEmitter : public ViewEventEmitter { - public: - using ViewEventEmitter::ViewEventEmitter; - - - - -}; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateEventEmitterH can generate fixture COMPONENT_WITH_EDGE_INSET_STATE_PROPS 1`] = ` -Map { - "EventEmitters.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateEventEmitterH.js - */ -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -class JSI_EXPORT SimpleComponentEventEmitter : public ViewEventEmitter { - public: - using ViewEventEmitter::ViewEventEmitter; - - - - -}; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateEventEmitterH can generate fixture COMPONENT_WITH_FLOAT_STATE 1`] = ` -Map { - "EventEmitters.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateEventEmitterH.js - */ -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -class JSI_EXPORT SimpleComponentEventEmitter : public ViewEventEmitter { - public: - using ViewEventEmitter::ViewEventEmitter; - - - - -}; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateEventEmitterH can generate fixture COMPONENT_WITH_IMAGE_STATE 1`] = ` -Map { - "EventEmitters.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateEventEmitterH.js - */ -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -class JSI_EXPORT SimpleComponentEventEmitter : public ViewEventEmitter { - public: - using ViewEventEmitter::ViewEventEmitter; - - - - -}; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateEventEmitterH can generate fixture COMPONENT_WITH_INT_ENUM_STATE 1`] = ` -Map { - "EventEmitters.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateEventEmitterH.js - */ -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -class JSI_EXPORT SimpleComponentEventEmitter : public ViewEventEmitter { - public: - using ViewEventEmitter::ViewEventEmitter; - - - - -}; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateEventEmitterH can generate fixture COMPONENT_WITH_INT_STATE 1`] = ` -Map { - "EventEmitters.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateEventEmitterH.js - */ -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -class JSI_EXPORT SimpleComponentEventEmitter : public ViewEventEmitter { - public: - using ViewEventEmitter::ViewEventEmitter; - - - - -}; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateEventEmitterH can generate fixture COMPONENT_WITH_OBJECT_STATE 1`] = ` -Map { - "EventEmitters.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateEventEmitterH.js - */ -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -class JSI_EXPORT SimpleComponentEventEmitter : public ViewEventEmitter { - public: - using ViewEventEmitter::ViewEventEmitter; - - - - -}; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateEventEmitterH can generate fixture COMPONENT_WITH_POINT_STATE 1`] = ` -Map { - "EventEmitters.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateEventEmitterH.js - */ -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -class JSI_EXPORT SimpleComponentEventEmitter : public ViewEventEmitter { - public: - using ViewEventEmitter::ViewEventEmitter; - - - - -}; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateEventEmitterH can generate fixture COMPONENT_WITH_STRING_ENUM_STATE_PROPS 1`] = ` -Map { - "EventEmitters.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateEventEmitterH.js - */ -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -class JSI_EXPORT SimpleComponentEventEmitter : public ViewEventEmitter { - public: - using ViewEventEmitter::ViewEventEmitter; - - - - -}; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateEventEmitterH can generate fixture COMPONENT_WITH_STRING_STATE 1`] = ` -Map { - "EventEmitters.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateEventEmitterH.js - */ -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -class JSI_EXPORT SimpleComponentEventEmitter : public ViewEventEmitter { - public: - using ViewEventEmitter::ViewEventEmitter; - - - - -}; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateEventEmitterH can generate fixture COMPONENTS_WITH_IMAGES_IN_STATE 1`] = ` -Map { - "EventEmitters.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateEventEmitterH.js - */ -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -class JSI_EXPORT SimpleComponentEventEmitter : public ViewEventEmitter { - public: - using ViewEventEmitter::ViewEventEmitter; - - - - }; } // namespace react diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsCpp-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsCpp-test.js.snap index 29c8a79a20d57b..56ada8a6bffe13 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsCpp-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsCpp-test.js.snap @@ -209,502 +209,6 @@ CommandNativeComponentProps::CommandNativeComponentProps( } `; -exports[`GeneratePropsCpp can generate fixture COMPONENT_WITH_ARRAY_OF_OBJECTS_STATE 1`] = ` -Map { - "Props.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GeneratePropsCpp.js - */ - -#include -#include -#include - -namespace facebook { -namespace react { - -SimpleComponentProps::SimpleComponentProps( - const PropsParserContext &context, - const SimpleComponentProps &sourceProps, - const RawProps &rawProps): ViewProps(context, sourceProps, rawProps) - - - {} - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GeneratePropsCpp can generate fixture COMPONENT_WITH_ARRAY_STATE 1`] = ` -Map { - "Props.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GeneratePropsCpp.js - */ - -#include -#include -#include - -namespace facebook { -namespace react { - -SimpleComponentProps::SimpleComponentProps( - const PropsParserContext &context, - const SimpleComponentProps &sourceProps, - const RawProps &rawProps): ViewProps(context, sourceProps, rawProps) - - - {} - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GeneratePropsCpp can generate fixture COMPONENT_WITH_BOOL_STATE 1`] = ` -Map { - "Props.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GeneratePropsCpp.js - */ - -#include -#include -#include - -namespace facebook { -namespace react { - -SimpleComponentProps::SimpleComponentProps( - const PropsParserContext &context, - const SimpleComponentProps &sourceProps, - const RawProps &rawProps): ViewProps(context, sourceProps, rawProps) - - - {} - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GeneratePropsCpp can generate fixture COMPONENT_WITH_COLOR_STATE 1`] = ` -Map { - "Props.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GeneratePropsCpp.js - */ - -#include -#include -#include - -namespace facebook { -namespace react { - -SimpleComponentProps::SimpleComponentProps( - const PropsParserContext &context, - const SimpleComponentProps &sourceProps, - const RawProps &rawProps): ViewProps(context, sourceProps, rawProps) - - - {} - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GeneratePropsCpp can generate fixture COMPONENT_WITH_DOUBLE_STATE 1`] = ` -Map { - "Props.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GeneratePropsCpp.js - */ - -#include -#include -#include - -namespace facebook { -namespace react { - -SimpleComponentProps::SimpleComponentProps( - const PropsParserContext &context, - const SimpleComponentProps &sourceProps, - const RawProps &rawProps): ViewProps(context, sourceProps, rawProps) - - - {} - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GeneratePropsCpp can generate fixture COMPONENT_WITH_EDGE_INSET_STATE_PROPS 1`] = ` -Map { - "Props.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GeneratePropsCpp.js - */ - -#include -#include -#include - -namespace facebook { -namespace react { - -SimpleComponentProps::SimpleComponentProps( - const PropsParserContext &context, - const SimpleComponentProps &sourceProps, - const RawProps &rawProps): ViewProps(context, sourceProps, rawProps) - - - {} - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GeneratePropsCpp can generate fixture COMPONENT_WITH_FLOAT_STATE 1`] = ` -Map { - "Props.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GeneratePropsCpp.js - */ - -#include -#include -#include - -namespace facebook { -namespace react { - -SimpleComponentProps::SimpleComponentProps( - const PropsParserContext &context, - const SimpleComponentProps &sourceProps, - const RawProps &rawProps): ViewProps(context, sourceProps, rawProps) - - - {} - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GeneratePropsCpp can generate fixture COMPONENT_WITH_IMAGE_STATE 1`] = ` -Map { - "Props.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GeneratePropsCpp.js - */ - -#include -#include -#include - -namespace facebook { -namespace react { - -SimpleComponentProps::SimpleComponentProps( - const PropsParserContext &context, - const SimpleComponentProps &sourceProps, - const RawProps &rawProps): ViewProps(context, sourceProps, rawProps) - - - {} - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GeneratePropsCpp can generate fixture COMPONENT_WITH_INT_ENUM_STATE 1`] = ` -Map { - "Props.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GeneratePropsCpp.js - */ - -#include -#include -#include - -namespace facebook { -namespace react { - -SimpleComponentProps::SimpleComponentProps( - const PropsParserContext &context, - const SimpleComponentProps &sourceProps, - const RawProps &rawProps): ViewProps(context, sourceProps, rawProps) - - - {} - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GeneratePropsCpp can generate fixture COMPONENT_WITH_INT_STATE 1`] = ` -Map { - "Props.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GeneratePropsCpp.js - */ - -#include -#include -#include - -namespace facebook { -namespace react { - -SimpleComponentProps::SimpleComponentProps( - const PropsParserContext &context, - const SimpleComponentProps &sourceProps, - const RawProps &rawProps): ViewProps(context, sourceProps, rawProps) - - - {} - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GeneratePropsCpp can generate fixture COMPONENT_WITH_OBJECT_STATE 1`] = ` -Map { - "Props.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GeneratePropsCpp.js - */ - -#include -#include -#include - -namespace facebook { -namespace react { - -SimpleComponentProps::SimpleComponentProps( - const PropsParserContext &context, - const SimpleComponentProps &sourceProps, - const RawProps &rawProps): ViewProps(context, sourceProps, rawProps) - - - {} - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GeneratePropsCpp can generate fixture COMPONENT_WITH_POINT_STATE 1`] = ` -Map { - "Props.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GeneratePropsCpp.js - */ - -#include -#include -#include - -namespace facebook { -namespace react { - -SimpleComponentProps::SimpleComponentProps( - const PropsParserContext &context, - const SimpleComponentProps &sourceProps, - const RawProps &rawProps): ViewProps(context, sourceProps, rawProps) - - - {} - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GeneratePropsCpp can generate fixture COMPONENT_WITH_STRING_ENUM_STATE_PROPS 1`] = ` -Map { - "Props.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GeneratePropsCpp.js - */ - -#include -#include -#include - -namespace facebook { -namespace react { - -SimpleComponentProps::SimpleComponentProps( - const PropsParserContext &context, - const SimpleComponentProps &sourceProps, - const RawProps &rawProps): ViewProps(context, sourceProps, rawProps) - - - {} - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GeneratePropsCpp can generate fixture COMPONENT_WITH_STRING_STATE 1`] = ` -Map { - "Props.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GeneratePropsCpp.js - */ - -#include -#include -#include - -namespace facebook { -namespace react { - -SimpleComponentProps::SimpleComponentProps( - const PropsParserContext &context, - const SimpleComponentProps &sourceProps, - const RawProps &rawProps): ViewProps(context, sourceProps, rawProps) - - - {} - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GeneratePropsCpp can generate fixture COMPONENTS_WITH_IMAGES_IN_STATE 1`] = ` -Map { - "Props.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GeneratePropsCpp.js - */ - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -SimpleComponentProps::SimpleComponentProps( - const PropsParserContext &context, - const SimpleComponentProps &sourceProps, - const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), - - imageSource(convertRawProp(context, rawProps, \\"imageSource\\", sourceProps.imageSource, {})) - {} - -} // namespace react -} // namespace facebook -", -} -`; - exports[`GeneratePropsCpp can generate fixture DOUBLE_PROPS 1`] = ` Map { "Props.cpp" => " diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsH-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsH-test.js.snap index 88f56072d74278..7f8a84fe002064 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsH-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsH-test.js.snap @@ -439,547 +439,6 @@ class JSI_EXPORT CommandNativeComponentProps final : public ViewProps { } `; -exports[`GeneratePropsH can generate fixture COMPONENT_WITH_ARRAY_OF_OBJECTS_STATE 1`] = ` -Map { - "Props.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GeneratePropsH.js - */ -#pragma once - -#include -#include -#include - -namespace facebook { -namespace react { - -class JSI_EXPORT SimpleComponentProps final : public ViewProps { - public: - SimpleComponentProps() = default; - SimpleComponentProps(const PropsParserContext& context, const SimpleComponentProps &sourceProps, const RawProps &rawProps); - -#pragma mark - Props - - -}; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GeneratePropsH can generate fixture COMPONENT_WITH_ARRAY_STATE 1`] = ` -Map { - "Props.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GeneratePropsH.js - */ -#pragma once - -#include -#include -#include - -namespace facebook { -namespace react { - -class JSI_EXPORT SimpleComponentProps final : public ViewProps { - public: - SimpleComponentProps() = default; - SimpleComponentProps(const PropsParserContext& context, const SimpleComponentProps &sourceProps, const RawProps &rawProps); - -#pragma mark - Props - - -}; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GeneratePropsH can generate fixture COMPONENT_WITH_BOOL_STATE 1`] = ` -Map { - "Props.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GeneratePropsH.js - */ -#pragma once - -#include -#include -#include - -namespace facebook { -namespace react { - -class JSI_EXPORT SimpleComponentProps final : public ViewProps { - public: - SimpleComponentProps() = default; - SimpleComponentProps(const PropsParserContext& context, const SimpleComponentProps &sourceProps, const RawProps &rawProps); - -#pragma mark - Props - - -}; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GeneratePropsH can generate fixture COMPONENT_WITH_COLOR_STATE 1`] = ` -Map { - "Props.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GeneratePropsH.js - */ -#pragma once - -#include -#include -#include - -namespace facebook { -namespace react { - -class JSI_EXPORT SimpleComponentProps final : public ViewProps { - public: - SimpleComponentProps() = default; - SimpleComponentProps(const PropsParserContext& context, const SimpleComponentProps &sourceProps, const RawProps &rawProps); - -#pragma mark - Props - - -}; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GeneratePropsH can generate fixture COMPONENT_WITH_DOUBLE_STATE 1`] = ` -Map { - "Props.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GeneratePropsH.js - */ -#pragma once - -#include -#include -#include - -namespace facebook { -namespace react { - -class JSI_EXPORT SimpleComponentProps final : public ViewProps { - public: - SimpleComponentProps() = default; - SimpleComponentProps(const PropsParserContext& context, const SimpleComponentProps &sourceProps, const RawProps &rawProps); - -#pragma mark - Props - - -}; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GeneratePropsH can generate fixture COMPONENT_WITH_EDGE_INSET_STATE_PROPS 1`] = ` -Map { - "Props.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GeneratePropsH.js - */ -#pragma once - -#include -#include -#include - -namespace facebook { -namespace react { - -class JSI_EXPORT SimpleComponentProps final : public ViewProps { - public: - SimpleComponentProps() = default; - SimpleComponentProps(const PropsParserContext& context, const SimpleComponentProps &sourceProps, const RawProps &rawProps); - -#pragma mark - Props - - -}; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GeneratePropsH can generate fixture COMPONENT_WITH_FLOAT_STATE 1`] = ` -Map { - "Props.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GeneratePropsH.js - */ -#pragma once - -#include -#include -#include - -namespace facebook { -namespace react { - -class JSI_EXPORT SimpleComponentProps final : public ViewProps { - public: - SimpleComponentProps() = default; - SimpleComponentProps(const PropsParserContext& context, const SimpleComponentProps &sourceProps, const RawProps &rawProps); - -#pragma mark - Props - - -}; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GeneratePropsH can generate fixture COMPONENT_WITH_IMAGE_STATE 1`] = ` -Map { - "Props.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GeneratePropsH.js - */ -#pragma once - -#include -#include -#include - -namespace facebook { -namespace react { - -class JSI_EXPORT SimpleComponentProps final : public ViewProps { - public: - SimpleComponentProps() = default; - SimpleComponentProps(const PropsParserContext& context, const SimpleComponentProps &sourceProps, const RawProps &rawProps); - -#pragma mark - Props - - -}; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GeneratePropsH can generate fixture COMPONENT_WITH_INT_ENUM_STATE 1`] = ` -Map { - "Props.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GeneratePropsH.js - */ -#pragma once - -#include -#include -#include - -namespace facebook { -namespace react { - -class JSI_EXPORT SimpleComponentProps final : public ViewProps { - public: - SimpleComponentProps() = default; - SimpleComponentProps(const PropsParserContext& context, const SimpleComponentProps &sourceProps, const RawProps &rawProps); - -#pragma mark - Props - - -}; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GeneratePropsH can generate fixture COMPONENT_WITH_INT_STATE 1`] = ` -Map { - "Props.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GeneratePropsH.js - */ -#pragma once - -#include -#include -#include - -namespace facebook { -namespace react { - -class JSI_EXPORT SimpleComponentProps final : public ViewProps { - public: - SimpleComponentProps() = default; - SimpleComponentProps(const PropsParserContext& context, const SimpleComponentProps &sourceProps, const RawProps &rawProps); - -#pragma mark - Props - - -}; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GeneratePropsH can generate fixture COMPONENT_WITH_OBJECT_STATE 1`] = ` -Map { - "Props.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GeneratePropsH.js - */ -#pragma once - -#include -#include -#include - -namespace facebook { -namespace react { - -class JSI_EXPORT SimpleComponentProps final : public ViewProps { - public: - SimpleComponentProps() = default; - SimpleComponentProps(const PropsParserContext& context, const SimpleComponentProps &sourceProps, const RawProps &rawProps); - -#pragma mark - Props - - -}; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GeneratePropsH can generate fixture COMPONENT_WITH_POINT_STATE 1`] = ` -Map { - "Props.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GeneratePropsH.js - */ -#pragma once - -#include -#include -#include - -namespace facebook { -namespace react { - -class JSI_EXPORT SimpleComponentProps final : public ViewProps { - public: - SimpleComponentProps() = default; - SimpleComponentProps(const PropsParserContext& context, const SimpleComponentProps &sourceProps, const RawProps &rawProps); - -#pragma mark - Props - - -}; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GeneratePropsH can generate fixture COMPONENT_WITH_STRING_ENUM_STATE_PROPS 1`] = ` -Map { - "Props.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GeneratePropsH.js - */ -#pragma once - -#include -#include -#include - -namespace facebook { -namespace react { - -class JSI_EXPORT SimpleComponentProps final : public ViewProps { - public: - SimpleComponentProps() = default; - SimpleComponentProps(const PropsParserContext& context, const SimpleComponentProps &sourceProps, const RawProps &rawProps); - -#pragma mark - Props - - -}; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GeneratePropsH can generate fixture COMPONENT_WITH_STRING_STATE 1`] = ` -Map { - "Props.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GeneratePropsH.js - */ -#pragma once - -#include -#include -#include - -namespace facebook { -namespace react { - -class JSI_EXPORT SimpleComponentProps final : public ViewProps { - public: - SimpleComponentProps() = default; - SimpleComponentProps(const PropsParserContext& context, const SimpleComponentProps &sourceProps, const RawProps &rawProps); - -#pragma mark - Props - - -}; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GeneratePropsH can generate fixture COMPONENTS_WITH_IMAGES_IN_STATE 1`] = ` -Map { - "Props.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GeneratePropsH.js - */ -#pragma once - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -class JSI_EXPORT SimpleComponentProps final : public ViewProps { - public: - SimpleComponentProps() = default; - SimpleComponentProps(const PropsParserContext& context, const SimpleComponentProps &sourceProps, const RawProps &rawProps); - -#pragma mark - Props - - ImageSource imageSource{}; -}; - -} // namespace react -} // namespace facebook -", -} -`; - exports[`GeneratePropsH can generate fixture DOUBLE_PROPS 1`] = ` Map { "Props.h" => " diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaDelegate-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaDelegate-test.js.snap index be52cfb9fc62fd..6c5dd2dbb4f79c 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaDelegate-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaDelegate-test.js.snap @@ -275,478 +275,6 @@ public class CommandNativeComponentManagerDelegate "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GeneratePropsJavaDelegate.js -*/ - -package com.facebook.react.viewmanagers; - -import android.view.View; -import androidx.annotation.Nullable; -import com.facebook.react.uimanager.BaseViewManagerDelegate; -import com.facebook.react.uimanager.BaseViewManagerInterface; - -public class SimpleComponentManagerDelegate & SimpleComponentManagerInterface> extends BaseViewManagerDelegate { - public SimpleComponentManagerDelegate(U viewManager) { - super(viewManager); - } - @Override - public void setProperty(T view, String propName, @Nullable Object value) { - super.setProperty(view, propName, value); - } -} -", -} -`; - -exports[`GeneratePropsJavaDelegate can generate fixture COMPONENT_WITH_ARRAY_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/SimpleComponentManagerDelegate.java" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GeneratePropsJavaDelegate.js -*/ - -package com.facebook.react.viewmanagers; - -import android.view.View; -import androidx.annotation.Nullable; -import com.facebook.react.uimanager.BaseViewManagerDelegate; -import com.facebook.react.uimanager.BaseViewManagerInterface; - -public class SimpleComponentManagerDelegate & SimpleComponentManagerInterface> extends BaseViewManagerDelegate { - public SimpleComponentManagerDelegate(U viewManager) { - super(viewManager); - } - @Override - public void setProperty(T view, String propName, @Nullable Object value) { - super.setProperty(view, propName, value); - } -} -", -} -`; - -exports[`GeneratePropsJavaDelegate can generate fixture COMPONENT_WITH_BOOL_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/SimpleComponentManagerDelegate.java" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GeneratePropsJavaDelegate.js -*/ - -package com.facebook.react.viewmanagers; - -import android.view.View; -import androidx.annotation.Nullable; -import com.facebook.react.uimanager.BaseViewManagerDelegate; -import com.facebook.react.uimanager.BaseViewManagerInterface; - -public class SimpleComponentManagerDelegate & SimpleComponentManagerInterface> extends BaseViewManagerDelegate { - public SimpleComponentManagerDelegate(U viewManager) { - super(viewManager); - } - @Override - public void setProperty(T view, String propName, @Nullable Object value) { - super.setProperty(view, propName, value); - } -} -", -} -`; - -exports[`GeneratePropsJavaDelegate can generate fixture COMPONENT_WITH_COLOR_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/SimpleComponentManagerDelegate.java" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GeneratePropsJavaDelegate.js -*/ - -package com.facebook.react.viewmanagers; - -import android.view.View; -import androidx.annotation.Nullable; -import com.facebook.react.uimanager.BaseViewManagerDelegate; -import com.facebook.react.uimanager.BaseViewManagerInterface; - -public class SimpleComponentManagerDelegate & SimpleComponentManagerInterface> extends BaseViewManagerDelegate { - public SimpleComponentManagerDelegate(U viewManager) { - super(viewManager); - } - @Override - public void setProperty(T view, String propName, @Nullable Object value) { - super.setProperty(view, propName, value); - } -} -", -} -`; - -exports[`GeneratePropsJavaDelegate can generate fixture COMPONENT_WITH_DOUBLE_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/SimpleComponentManagerDelegate.java" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GeneratePropsJavaDelegate.js -*/ - -package com.facebook.react.viewmanagers; - -import android.view.View; -import androidx.annotation.Nullable; -import com.facebook.react.uimanager.BaseViewManagerDelegate; -import com.facebook.react.uimanager.BaseViewManagerInterface; - -public class SimpleComponentManagerDelegate & SimpleComponentManagerInterface> extends BaseViewManagerDelegate { - public SimpleComponentManagerDelegate(U viewManager) { - super(viewManager); - } - @Override - public void setProperty(T view, String propName, @Nullable Object value) { - super.setProperty(view, propName, value); - } -} -", -} -`; - -exports[`GeneratePropsJavaDelegate can generate fixture COMPONENT_WITH_EDGE_INSET_STATE_PROPS 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/SimpleComponentManagerDelegate.java" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GeneratePropsJavaDelegate.js -*/ - -package com.facebook.react.viewmanagers; - -import android.view.View; -import androidx.annotation.Nullable; -import com.facebook.react.uimanager.BaseViewManagerDelegate; -import com.facebook.react.uimanager.BaseViewManagerInterface; - -public class SimpleComponentManagerDelegate & SimpleComponentManagerInterface> extends BaseViewManagerDelegate { - public SimpleComponentManagerDelegate(U viewManager) { - super(viewManager); - } - @Override - public void setProperty(T view, String propName, @Nullable Object value) { - super.setProperty(view, propName, value); - } -} -", -} -`; - -exports[`GeneratePropsJavaDelegate can generate fixture COMPONENT_WITH_FLOAT_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/SimpleComponentManagerDelegate.java" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GeneratePropsJavaDelegate.js -*/ - -package com.facebook.react.viewmanagers; - -import android.view.View; -import androidx.annotation.Nullable; -import com.facebook.react.uimanager.BaseViewManagerDelegate; -import com.facebook.react.uimanager.BaseViewManagerInterface; - -public class SimpleComponentManagerDelegate & SimpleComponentManagerInterface> extends BaseViewManagerDelegate { - public SimpleComponentManagerDelegate(U viewManager) { - super(viewManager); - } - @Override - public void setProperty(T view, String propName, @Nullable Object value) { - super.setProperty(view, propName, value); - } -} -", -} -`; - -exports[`GeneratePropsJavaDelegate can generate fixture COMPONENT_WITH_IMAGE_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/SimpleComponentManagerDelegate.java" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GeneratePropsJavaDelegate.js -*/ - -package com.facebook.react.viewmanagers; - -import android.view.View; -import androidx.annotation.Nullable; -import com.facebook.react.uimanager.BaseViewManagerDelegate; -import com.facebook.react.uimanager.BaseViewManagerInterface; - -public class SimpleComponentManagerDelegate & SimpleComponentManagerInterface> extends BaseViewManagerDelegate { - public SimpleComponentManagerDelegate(U viewManager) { - super(viewManager); - } - @Override - public void setProperty(T view, String propName, @Nullable Object value) { - super.setProperty(view, propName, value); - } -} -", -} -`; - -exports[`GeneratePropsJavaDelegate can generate fixture COMPONENT_WITH_INT_ENUM_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/SimpleComponentManagerDelegate.java" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GeneratePropsJavaDelegate.js -*/ - -package com.facebook.react.viewmanagers; - -import android.view.View; -import androidx.annotation.Nullable; -import com.facebook.react.uimanager.BaseViewManagerDelegate; -import com.facebook.react.uimanager.BaseViewManagerInterface; - -public class SimpleComponentManagerDelegate & SimpleComponentManagerInterface> extends BaseViewManagerDelegate { - public SimpleComponentManagerDelegate(U viewManager) { - super(viewManager); - } - @Override - public void setProperty(T view, String propName, @Nullable Object value) { - super.setProperty(view, propName, value); - } -} -", -} -`; - -exports[`GeneratePropsJavaDelegate can generate fixture COMPONENT_WITH_INT_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/SimpleComponentManagerDelegate.java" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GeneratePropsJavaDelegate.js -*/ - -package com.facebook.react.viewmanagers; - -import android.view.View; -import androidx.annotation.Nullable; -import com.facebook.react.uimanager.BaseViewManagerDelegate; -import com.facebook.react.uimanager.BaseViewManagerInterface; - -public class SimpleComponentManagerDelegate & SimpleComponentManagerInterface> extends BaseViewManagerDelegate { - public SimpleComponentManagerDelegate(U viewManager) { - super(viewManager); - } - @Override - public void setProperty(T view, String propName, @Nullable Object value) { - super.setProperty(view, propName, value); - } -} -", -} -`; - -exports[`GeneratePropsJavaDelegate can generate fixture COMPONENT_WITH_OBJECT_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/SimpleComponentManagerDelegate.java" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GeneratePropsJavaDelegate.js -*/ - -package com.facebook.react.viewmanagers; - -import android.view.View; -import androidx.annotation.Nullable; -import com.facebook.react.uimanager.BaseViewManagerDelegate; -import com.facebook.react.uimanager.BaseViewManagerInterface; - -public class SimpleComponentManagerDelegate & SimpleComponentManagerInterface> extends BaseViewManagerDelegate { - public SimpleComponentManagerDelegate(U viewManager) { - super(viewManager); - } - @Override - public void setProperty(T view, String propName, @Nullable Object value) { - super.setProperty(view, propName, value); - } -} -", -} -`; - -exports[`GeneratePropsJavaDelegate can generate fixture COMPONENT_WITH_POINT_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/SimpleComponentManagerDelegate.java" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GeneratePropsJavaDelegate.js -*/ - -package com.facebook.react.viewmanagers; - -import android.view.View; -import androidx.annotation.Nullable; -import com.facebook.react.uimanager.BaseViewManagerDelegate; -import com.facebook.react.uimanager.BaseViewManagerInterface; - -public class SimpleComponentManagerDelegate & SimpleComponentManagerInterface> extends BaseViewManagerDelegate { - public SimpleComponentManagerDelegate(U viewManager) { - super(viewManager); - } - @Override - public void setProperty(T view, String propName, @Nullable Object value) { - super.setProperty(view, propName, value); - } -} -", -} -`; - -exports[`GeneratePropsJavaDelegate can generate fixture COMPONENT_WITH_STRING_ENUM_STATE_PROPS 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/SimpleComponentManagerDelegate.java" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GeneratePropsJavaDelegate.js -*/ - -package com.facebook.react.viewmanagers; - -import android.view.View; -import androidx.annotation.Nullable; -import com.facebook.react.uimanager.BaseViewManagerDelegate; -import com.facebook.react.uimanager.BaseViewManagerInterface; - -public class SimpleComponentManagerDelegate & SimpleComponentManagerInterface> extends BaseViewManagerDelegate { - public SimpleComponentManagerDelegate(U viewManager) { - super(viewManager); - } - @Override - public void setProperty(T view, String propName, @Nullable Object value) { - super.setProperty(view, propName, value); - } -} -", -} -`; - -exports[`GeneratePropsJavaDelegate can generate fixture COMPONENT_WITH_STRING_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/SimpleComponentManagerDelegate.java" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GeneratePropsJavaDelegate.js -*/ - -package com.facebook.react.viewmanagers; - -import android.view.View; -import androidx.annotation.Nullable; -import com.facebook.react.uimanager.BaseViewManagerDelegate; -import com.facebook.react.uimanager.BaseViewManagerInterface; - -public class SimpleComponentManagerDelegate & SimpleComponentManagerInterface> extends BaseViewManagerDelegate { - public SimpleComponentManagerDelegate(U viewManager) { - super(viewManager); - } - @Override - public void setProperty(T view, String propName, @Nullable Object value) { - super.setProperty(view, propName, value); - } -} -", -} -`; - -exports[`GeneratePropsJavaDelegate can generate fixture COMPONENTS_WITH_IMAGES_IN_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/SimpleComponentManagerDelegate.java" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GeneratePropsJavaDelegate.js -*/ - -package com.facebook.react.viewmanagers; - -import android.view.View; -import androidx.annotation.Nullable; -import com.facebook.react.bridge.ReadableMap; -import com.facebook.react.uimanager.BaseViewManagerDelegate; -import com.facebook.react.uimanager.BaseViewManagerInterface; - -public class SimpleComponentManagerDelegate & SimpleComponentManagerInterface> extends BaseViewManagerDelegate { - public SimpleComponentManagerDelegate(U viewManager) { - super(viewManager); - } - @Override - public void setProperty(T view, String propName, @Nullable Object value) { - switch (propName) { - case \\"imageSource\\": - mViewManager.setImageSource(view, (ReadableMap) value); - break; - default: - super.setProperty(view, propName, value); - } - } -} -", -} -`; - exports[`GeneratePropsJavaDelegate can generate fixture DOUBLE_PROPS 1`] = ` Map { "java/com/facebook/react/viewmanagers/DoublePropNativeComponentManagerDelegate.java" => "/** diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaInterface-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaInterface-test.js.snap index b3fc55fb785898..c4e652f19a38a4 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaInterface-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaInterface-test.js.snap @@ -152,338 +152,6 @@ public interface CommandNativeComponentManagerInterface { } `; -exports[`GeneratePropsJavaInterface can generate fixture COMPONENT_WITH_ARRAY_OF_OBJECTS_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/SimpleComponentManagerInterface.java" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GeneratePropsJavaInterface.js -*/ - -package com.facebook.react.viewmanagers; - -import android.view.View; - -public interface SimpleComponentManagerInterface { - // No props -} -", -} -`; - -exports[`GeneratePropsJavaInterface can generate fixture COMPONENT_WITH_ARRAY_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/SimpleComponentManagerInterface.java" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GeneratePropsJavaInterface.js -*/ - -package com.facebook.react.viewmanagers; - -import android.view.View; - -public interface SimpleComponentManagerInterface { - // No props -} -", -} -`; - -exports[`GeneratePropsJavaInterface can generate fixture COMPONENT_WITH_BOOL_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/SimpleComponentManagerInterface.java" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GeneratePropsJavaInterface.js -*/ - -package com.facebook.react.viewmanagers; - -import android.view.View; - -public interface SimpleComponentManagerInterface { - // No props -} -", -} -`; - -exports[`GeneratePropsJavaInterface can generate fixture COMPONENT_WITH_COLOR_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/SimpleComponentManagerInterface.java" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GeneratePropsJavaInterface.js -*/ - -package com.facebook.react.viewmanagers; - -import android.view.View; - -public interface SimpleComponentManagerInterface { - // No props -} -", -} -`; - -exports[`GeneratePropsJavaInterface can generate fixture COMPONENT_WITH_DOUBLE_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/SimpleComponentManagerInterface.java" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GeneratePropsJavaInterface.js -*/ - -package com.facebook.react.viewmanagers; - -import android.view.View; - -public interface SimpleComponentManagerInterface { - // No props -} -", -} -`; - -exports[`GeneratePropsJavaInterface can generate fixture COMPONENT_WITH_EDGE_INSET_STATE_PROPS 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/SimpleComponentManagerInterface.java" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GeneratePropsJavaInterface.js -*/ - -package com.facebook.react.viewmanagers; - -import android.view.View; - -public interface SimpleComponentManagerInterface { - // No props -} -", -} -`; - -exports[`GeneratePropsJavaInterface can generate fixture COMPONENT_WITH_FLOAT_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/SimpleComponentManagerInterface.java" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GeneratePropsJavaInterface.js -*/ - -package com.facebook.react.viewmanagers; - -import android.view.View; - -public interface SimpleComponentManagerInterface { - // No props -} -", -} -`; - -exports[`GeneratePropsJavaInterface can generate fixture COMPONENT_WITH_IMAGE_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/SimpleComponentManagerInterface.java" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GeneratePropsJavaInterface.js -*/ - -package com.facebook.react.viewmanagers; - -import android.view.View; - -public interface SimpleComponentManagerInterface { - // No props -} -", -} -`; - -exports[`GeneratePropsJavaInterface can generate fixture COMPONENT_WITH_INT_ENUM_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/SimpleComponentManagerInterface.java" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GeneratePropsJavaInterface.js -*/ - -package com.facebook.react.viewmanagers; - -import android.view.View; - -public interface SimpleComponentManagerInterface { - // No props -} -", -} -`; - -exports[`GeneratePropsJavaInterface can generate fixture COMPONENT_WITH_INT_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/SimpleComponentManagerInterface.java" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GeneratePropsJavaInterface.js -*/ - -package com.facebook.react.viewmanagers; - -import android.view.View; - -public interface SimpleComponentManagerInterface { - // No props -} -", -} -`; - -exports[`GeneratePropsJavaInterface can generate fixture COMPONENT_WITH_OBJECT_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/SimpleComponentManagerInterface.java" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GeneratePropsJavaInterface.js -*/ - -package com.facebook.react.viewmanagers; - -import android.view.View; - -public interface SimpleComponentManagerInterface { - // No props -} -", -} -`; - -exports[`GeneratePropsJavaInterface can generate fixture COMPONENT_WITH_POINT_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/SimpleComponentManagerInterface.java" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GeneratePropsJavaInterface.js -*/ - -package com.facebook.react.viewmanagers; - -import android.view.View; - -public interface SimpleComponentManagerInterface { - // No props -} -", -} -`; - -exports[`GeneratePropsJavaInterface can generate fixture COMPONENT_WITH_STRING_ENUM_STATE_PROPS 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/SimpleComponentManagerInterface.java" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GeneratePropsJavaInterface.js -*/ - -package com.facebook.react.viewmanagers; - -import android.view.View; - -public interface SimpleComponentManagerInterface { - // No props -} -", -} -`; - -exports[`GeneratePropsJavaInterface can generate fixture COMPONENT_WITH_STRING_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/SimpleComponentManagerInterface.java" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GeneratePropsJavaInterface.js -*/ - -package com.facebook.react.viewmanagers; - -import android.view.View; - -public interface SimpleComponentManagerInterface { - // No props -} -", -} -`; - -exports[`GeneratePropsJavaInterface can generate fixture COMPONENTS_WITH_IMAGES_IN_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/SimpleComponentManagerInterface.java" => "/** -* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -* -* Do not edit this file as changes may cause incorrect behavior and will be lost -* once the code is regenerated. -* -* @generated by codegen project: GeneratePropsJavaInterface.js -*/ - -package com.facebook.react.viewmanagers; - -import android.view.View; -import androidx.annotation.Nullable; -import com.facebook.react.bridge.ReadableMap; - -public interface SimpleComponentManagerInterface { - void setImageSource(T view, @Nullable ReadableMap value); -} -", -} -`; - exports[`GeneratePropsJavaInterface can generate fixture DOUBLE_PROPS 1`] = ` Map { "java/com/facebook/react/viewmanagers/DoublePropNativeComponentManagerInterface.java" => "/** diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaPojo-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaPojo-test.js.snap index 3fe66b223cce6a..9cb2b17fe2b341 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaPojo-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaPojo-test.js.snap @@ -340,371 +340,6 @@ public class CommandNativeComponentProps { } `; -exports[`GeneratePropsJavaPojo can generate fixture COMPONENT_WITH_ARRAY_OF_OBJECTS_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/MyComponent/SimpleComponentProps.java" => "/** -* Copyright (c) Meta Platforms, Inc. and affiliates. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -* -* @generated by codegen project: GeneratePropsJavaPojo.js -*/ - -package com.facebook.react.viewmanagers.MyComponent; - -import com.facebook.proguard.annotations.DoNotStrip; - -@DoNotStrip -public class SimpleComponentProps { - - -} -", -} -`; - -exports[`GeneratePropsJavaPojo can generate fixture COMPONENT_WITH_ARRAY_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/MyComponent/SimpleComponentProps.java" => "/** -* Copyright (c) Meta Platforms, Inc. and affiliates. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -* -* @generated by codegen project: GeneratePropsJavaPojo.js -*/ - -package com.facebook.react.viewmanagers.MyComponent; - -import com.facebook.proguard.annotations.DoNotStrip; - -@DoNotStrip -public class SimpleComponentProps { - - -} -", -} -`; - -exports[`GeneratePropsJavaPojo can generate fixture COMPONENT_WITH_BOOL_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/MyComponent/SimpleComponentProps.java" => "/** -* Copyright (c) Meta Platforms, Inc. and affiliates. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -* -* @generated by codegen project: GeneratePropsJavaPojo.js -*/ - -package com.facebook.react.viewmanagers.MyComponent; - -import com.facebook.proguard.annotations.DoNotStrip; - -@DoNotStrip -public class SimpleComponentProps { - - -} -", -} -`; - -exports[`GeneratePropsJavaPojo can generate fixture COMPONENT_WITH_COLOR_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/MyComponent/SimpleComponentProps.java" => "/** -* Copyright (c) Meta Platforms, Inc. and affiliates. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -* -* @generated by codegen project: GeneratePropsJavaPojo.js -*/ - -package com.facebook.react.viewmanagers.MyComponent; - -import com.facebook.proguard.annotations.DoNotStrip; - -@DoNotStrip -public class SimpleComponentProps { - - -} -", -} -`; - -exports[`GeneratePropsJavaPojo can generate fixture COMPONENT_WITH_DOUBLE_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/MyComponent/SimpleComponentProps.java" => "/** -* Copyright (c) Meta Platforms, Inc. and affiliates. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -* -* @generated by codegen project: GeneratePropsJavaPojo.js -*/ - -package com.facebook.react.viewmanagers.MyComponent; - -import com.facebook.proguard.annotations.DoNotStrip; - -@DoNotStrip -public class SimpleComponentProps { - - -} -", -} -`; - -exports[`GeneratePropsJavaPojo can generate fixture COMPONENT_WITH_EDGE_INSET_STATE_PROPS 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/MyComponent/SimpleComponentProps.java" => "/** -* Copyright (c) Meta Platforms, Inc. and affiliates. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -* -* @generated by codegen project: GeneratePropsJavaPojo.js -*/ - -package com.facebook.react.viewmanagers.MyComponent; - -import com.facebook.proguard.annotations.DoNotStrip; - -@DoNotStrip -public class SimpleComponentProps { - - -} -", -} -`; - -exports[`GeneratePropsJavaPojo can generate fixture COMPONENT_WITH_FLOAT_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/MyComponent/SimpleComponentProps.java" => "/** -* Copyright (c) Meta Platforms, Inc. and affiliates. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -* -* @generated by codegen project: GeneratePropsJavaPojo.js -*/ - -package com.facebook.react.viewmanagers.MyComponent; - -import com.facebook.proguard.annotations.DoNotStrip; - -@DoNotStrip -public class SimpleComponentProps { - - -} -", -} -`; - -exports[`GeneratePropsJavaPojo can generate fixture COMPONENT_WITH_IMAGE_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/MyComponent/SimpleComponentProps.java" => "/** -* Copyright (c) Meta Platforms, Inc. and affiliates. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -* -* @generated by codegen project: GeneratePropsJavaPojo.js -*/ - -package com.facebook.react.viewmanagers.MyComponent; - -import com.facebook.proguard.annotations.DoNotStrip; - -@DoNotStrip -public class SimpleComponentProps { - - -} -", -} -`; - -exports[`GeneratePropsJavaPojo can generate fixture COMPONENT_WITH_INT_ENUM_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/MyComponent/SimpleComponentProps.java" => "/** -* Copyright (c) Meta Platforms, Inc. and affiliates. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -* -* @generated by codegen project: GeneratePropsJavaPojo.js -*/ - -package com.facebook.react.viewmanagers.MyComponent; - -import com.facebook.proguard.annotations.DoNotStrip; - -@DoNotStrip -public class SimpleComponentProps { - - -} -", -} -`; - -exports[`GeneratePropsJavaPojo can generate fixture COMPONENT_WITH_INT_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/MyComponent/SimpleComponentProps.java" => "/** -* Copyright (c) Meta Platforms, Inc. and affiliates. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -* -* @generated by codegen project: GeneratePropsJavaPojo.js -*/ - -package com.facebook.react.viewmanagers.MyComponent; - -import com.facebook.proguard.annotations.DoNotStrip; - -@DoNotStrip -public class SimpleComponentProps { - - -} -", -} -`; - -exports[`GeneratePropsJavaPojo can generate fixture COMPONENT_WITH_OBJECT_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/MyComponent/SimpleComponentProps.java" => "/** -* Copyright (c) Meta Platforms, Inc. and affiliates. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -* -* @generated by codegen project: GeneratePropsJavaPojo.js -*/ - -package com.facebook.react.viewmanagers.MyComponent; - -import com.facebook.proguard.annotations.DoNotStrip; - -@DoNotStrip -public class SimpleComponentProps { - - -} -", -} -`; - -exports[`GeneratePropsJavaPojo can generate fixture COMPONENT_WITH_POINT_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/MyComponent/SimpleComponentProps.java" => "/** -* Copyright (c) Meta Platforms, Inc. and affiliates. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -* -* @generated by codegen project: GeneratePropsJavaPojo.js -*/ - -package com.facebook.react.viewmanagers.MyComponent; - -import com.facebook.proguard.annotations.DoNotStrip; - -@DoNotStrip -public class SimpleComponentProps { - - -} -", -} -`; - -exports[`GeneratePropsJavaPojo can generate fixture COMPONENT_WITH_STRING_ENUM_STATE_PROPS 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/MyComponent/SimpleComponentProps.java" => "/** -* Copyright (c) Meta Platforms, Inc. and affiliates. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -* -* @generated by codegen project: GeneratePropsJavaPojo.js -*/ - -package com.facebook.react.viewmanagers.MyComponent; - -import com.facebook.proguard.annotations.DoNotStrip; - -@DoNotStrip -public class SimpleComponentProps { - - -} -", -} -`; - -exports[`GeneratePropsJavaPojo can generate fixture COMPONENT_WITH_STRING_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/MyComponent/SimpleComponentProps.java" => "/** -* Copyright (c) Meta Platforms, Inc. and affiliates. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -* -* @generated by codegen project: GeneratePropsJavaPojo.js -*/ - -package com.facebook.react.viewmanagers.MyComponent; - -import com.facebook.proguard.annotations.DoNotStrip; - -@DoNotStrip -public class SimpleComponentProps { - - -} -", -} -`; - -exports[`GeneratePropsJavaPojo can generate fixture COMPONENTS_WITH_IMAGES_IN_STATE 1`] = ` -Map { - "java/com/facebook/react/viewmanagers/MyComponent/SimpleComponentProps.java" => "/** -* Copyright (c) Meta Platforms, Inc. and affiliates. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -* -* @generated by codegen project: GeneratePropsJavaPojo.js -*/ - -package com.facebook.react.viewmanagers.MyComponent; - -import androidx.annotation.Nullable; -import com.facebook.proguard.annotations.DoNotStrip; -import com.facebook.react.bridge.ReadableMap; - -@DoNotStrip -public class SimpleComponentProps { - private @Nullable ReadableMap mImageSource; - @DoNotStrip - public @Nullable ReadableMap getImageSource() { - return mImageSource; - } -} -", -} -`; - exports[`GeneratePropsJavaPojo can generate fixture DOUBLE_PROPS 1`] = ` Map { "java/com/facebook/react/viewmanagers/Switch/DoublePropNativeComponentProps.java" => "/** diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateShadowNodeCpp-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateShadowNodeCpp-test.js.snap index d71cc8d3952341..b09ab9ea8bebf3 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateShadowNodeCpp-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateShadowNodeCpp-test.js.snap @@ -150,381 +150,6 @@ extern const char CommandNativeComponentComponentName[] = \\"CommandNativeCompon } `; -exports[`GenerateShadowNodeCpp can generate fixture COMPONENT_WITH_ARRAY_OF_OBJECTS_STATE 1`] = ` -Map { - "ShadowNodes.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateShadowNodeCpp.js - */ - -#include - -namespace facebook { -namespace react { - -extern const char SimpleComponentComponentName[] = \\"SimpleComponent\\"; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateShadowNodeCpp can generate fixture COMPONENT_WITH_ARRAY_STATE 1`] = ` -Map { - "ShadowNodes.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateShadowNodeCpp.js - */ - -#include - -namespace facebook { -namespace react { - -extern const char SimpleComponentComponentName[] = \\"SimpleComponent\\"; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateShadowNodeCpp can generate fixture COMPONENT_WITH_BOOL_STATE 1`] = ` -Map { - "ShadowNodes.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateShadowNodeCpp.js - */ - -#include - -namespace facebook { -namespace react { - -extern const char SimpleComponentComponentName[] = \\"SimpleComponent\\"; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateShadowNodeCpp can generate fixture COMPONENT_WITH_COLOR_STATE 1`] = ` -Map { - "ShadowNodes.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateShadowNodeCpp.js - */ - -#include - -namespace facebook { -namespace react { - -extern const char SimpleComponentComponentName[] = \\"SimpleComponent\\"; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateShadowNodeCpp can generate fixture COMPONENT_WITH_DOUBLE_STATE 1`] = ` -Map { - "ShadowNodes.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateShadowNodeCpp.js - */ - -#include - -namespace facebook { -namespace react { - -extern const char SimpleComponentComponentName[] = \\"SimpleComponent\\"; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateShadowNodeCpp can generate fixture COMPONENT_WITH_EDGE_INSET_STATE_PROPS 1`] = ` -Map { - "ShadowNodes.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateShadowNodeCpp.js - */ - -#include - -namespace facebook { -namespace react { - -extern const char SimpleComponentComponentName[] = \\"SimpleComponent\\"; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateShadowNodeCpp can generate fixture COMPONENT_WITH_FLOAT_STATE 1`] = ` -Map { - "ShadowNodes.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateShadowNodeCpp.js - */ - -#include - -namespace facebook { -namespace react { - -extern const char SimpleComponentComponentName[] = \\"SimpleComponent\\"; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateShadowNodeCpp can generate fixture COMPONENT_WITH_IMAGE_STATE 1`] = ` -Map { - "ShadowNodes.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateShadowNodeCpp.js - */ - -#include - -namespace facebook { -namespace react { - -extern const char SimpleComponentComponentName[] = \\"SimpleComponent\\"; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateShadowNodeCpp can generate fixture COMPONENT_WITH_INT_ENUM_STATE 1`] = ` -Map { - "ShadowNodes.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateShadowNodeCpp.js - */ - -#include - -namespace facebook { -namespace react { - -extern const char SimpleComponentComponentName[] = \\"SimpleComponent\\"; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateShadowNodeCpp can generate fixture COMPONENT_WITH_INT_STATE 1`] = ` -Map { - "ShadowNodes.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateShadowNodeCpp.js - */ - -#include - -namespace facebook { -namespace react { - -extern const char SimpleComponentComponentName[] = \\"SimpleComponent\\"; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateShadowNodeCpp can generate fixture COMPONENT_WITH_OBJECT_STATE 1`] = ` -Map { - "ShadowNodes.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateShadowNodeCpp.js - */ - -#include - -namespace facebook { -namespace react { - -extern const char SimpleComponentComponentName[] = \\"SimpleComponent\\"; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateShadowNodeCpp can generate fixture COMPONENT_WITH_POINT_STATE 1`] = ` -Map { - "ShadowNodes.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateShadowNodeCpp.js - */ - -#include - -namespace facebook { -namespace react { - -extern const char SimpleComponentComponentName[] = \\"SimpleComponent\\"; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateShadowNodeCpp can generate fixture COMPONENT_WITH_STRING_ENUM_STATE_PROPS 1`] = ` -Map { - "ShadowNodes.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateShadowNodeCpp.js - */ - -#include - -namespace facebook { -namespace react { - -extern const char SimpleComponentComponentName[] = \\"SimpleComponent\\"; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateShadowNodeCpp can generate fixture COMPONENT_WITH_STRING_STATE 1`] = ` -Map { - "ShadowNodes.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateShadowNodeCpp.js - */ - -#include - -namespace facebook { -namespace react { - -extern const char SimpleComponentComponentName[] = \\"SimpleComponent\\"; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateShadowNodeCpp can generate fixture COMPONENTS_WITH_IMAGES_IN_STATE 1`] = ` -Map { - "ShadowNodes.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateShadowNodeCpp.js - */ - -#include - -namespace facebook { -namespace react { - -extern const char SimpleComponentComponentName[] = \\"SimpleComponent\\"; - -} // namespace react -} // namespace facebook -", -} -`; - exports[`GenerateShadowNodeCpp can generate fixture DOUBLE_PROPS 1`] = ` Map { "ShadowNodes.cpp" => " diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateShadowNodeH-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateShadowNodeH-test.js.snap index 6096930006eed2..86226abbbd7279 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateShadowNodeH-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateShadowNodeH-test.js.snap @@ -240,606 +240,6 @@ using CommandNativeComponentShadowNode = ConcreteViewShadowNode< } `; -exports[`GenerateShadowNodeH can generate fixture COMPONENT_WITH_ARRAY_OF_OBJECTS_STATE 1`] = ` -Map { - "ShadowNodes.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateShadowNodeH.js - */ - -#pragma once - -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -JSI_EXPORT extern const char SimpleComponentComponentName[]; - -/* - * \`ShadowNode\` for component. - */ -using SimpleComponentShadowNode = ConcreteViewShadowNode< - SimpleComponentComponentName, - SimpleComponentProps, - SimpleComponentEventEmitter, - SimpleComponentState>; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateShadowNodeH can generate fixture COMPONENT_WITH_ARRAY_STATE 1`] = ` -Map { - "ShadowNodes.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateShadowNodeH.js - */ - -#pragma once - -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -JSI_EXPORT extern const char SimpleComponentComponentName[]; - -/* - * \`ShadowNode\` for component. - */ -using SimpleComponentShadowNode = ConcreteViewShadowNode< - SimpleComponentComponentName, - SimpleComponentProps, - SimpleComponentEventEmitter, - SimpleComponentState>; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateShadowNodeH can generate fixture COMPONENT_WITH_BOOL_STATE 1`] = ` -Map { - "ShadowNodes.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateShadowNodeH.js - */ - -#pragma once - -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -JSI_EXPORT extern const char SimpleComponentComponentName[]; - -/* - * \`ShadowNode\` for component. - */ -using SimpleComponentShadowNode = ConcreteViewShadowNode< - SimpleComponentComponentName, - SimpleComponentProps, - SimpleComponentEventEmitter, - SimpleComponentState>; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateShadowNodeH can generate fixture COMPONENT_WITH_COLOR_STATE 1`] = ` -Map { - "ShadowNodes.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateShadowNodeH.js - */ - -#pragma once - -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -JSI_EXPORT extern const char SimpleComponentComponentName[]; - -/* - * \`ShadowNode\` for component. - */ -using SimpleComponentShadowNode = ConcreteViewShadowNode< - SimpleComponentComponentName, - SimpleComponentProps, - SimpleComponentEventEmitter, - SimpleComponentState>; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateShadowNodeH can generate fixture COMPONENT_WITH_DOUBLE_STATE 1`] = ` -Map { - "ShadowNodes.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateShadowNodeH.js - */ - -#pragma once - -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -JSI_EXPORT extern const char SimpleComponentComponentName[]; - -/* - * \`ShadowNode\` for component. - */ -using SimpleComponentShadowNode = ConcreteViewShadowNode< - SimpleComponentComponentName, - SimpleComponentProps, - SimpleComponentEventEmitter, - SimpleComponentState>; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateShadowNodeH can generate fixture COMPONENT_WITH_EDGE_INSET_STATE_PROPS 1`] = ` -Map { - "ShadowNodes.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateShadowNodeH.js - */ - -#pragma once - -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -JSI_EXPORT extern const char SimpleComponentComponentName[]; - -/* - * \`ShadowNode\` for component. - */ -using SimpleComponentShadowNode = ConcreteViewShadowNode< - SimpleComponentComponentName, - SimpleComponentProps, - SimpleComponentEventEmitter, - SimpleComponentState>; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateShadowNodeH can generate fixture COMPONENT_WITH_FLOAT_STATE 1`] = ` -Map { - "ShadowNodes.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateShadowNodeH.js - */ - -#pragma once - -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -JSI_EXPORT extern const char SimpleComponentComponentName[]; - -/* - * \`ShadowNode\` for component. - */ -using SimpleComponentShadowNode = ConcreteViewShadowNode< - SimpleComponentComponentName, - SimpleComponentProps, - SimpleComponentEventEmitter, - SimpleComponentState>; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateShadowNodeH can generate fixture COMPONENT_WITH_IMAGE_STATE 1`] = ` -Map { - "ShadowNodes.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateShadowNodeH.js - */ - -#pragma once - -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -JSI_EXPORT extern const char SimpleComponentComponentName[]; - -/* - * \`ShadowNode\` for component. - */ -using SimpleComponentShadowNode = ConcreteViewShadowNode< - SimpleComponentComponentName, - SimpleComponentProps, - SimpleComponentEventEmitter, - SimpleComponentState>; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateShadowNodeH can generate fixture COMPONENT_WITH_INT_ENUM_STATE 1`] = ` -Map { - "ShadowNodes.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateShadowNodeH.js - */ - -#pragma once - -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -JSI_EXPORT extern const char SimpleComponentComponentName[]; - -/* - * \`ShadowNode\` for component. - */ -using SimpleComponentShadowNode = ConcreteViewShadowNode< - SimpleComponentComponentName, - SimpleComponentProps, - SimpleComponentEventEmitter, - SimpleComponentState>; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateShadowNodeH can generate fixture COMPONENT_WITH_INT_STATE 1`] = ` -Map { - "ShadowNodes.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateShadowNodeH.js - */ - -#pragma once - -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -JSI_EXPORT extern const char SimpleComponentComponentName[]; - -/* - * \`ShadowNode\` for component. - */ -using SimpleComponentShadowNode = ConcreteViewShadowNode< - SimpleComponentComponentName, - SimpleComponentProps, - SimpleComponentEventEmitter, - SimpleComponentState>; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateShadowNodeH can generate fixture COMPONENT_WITH_OBJECT_STATE 1`] = ` -Map { - "ShadowNodes.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateShadowNodeH.js - */ - -#pragma once - -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -JSI_EXPORT extern const char SimpleComponentComponentName[]; - -/* - * \`ShadowNode\` for component. - */ -using SimpleComponentShadowNode = ConcreteViewShadowNode< - SimpleComponentComponentName, - SimpleComponentProps, - SimpleComponentEventEmitter, - SimpleComponentState>; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateShadowNodeH can generate fixture COMPONENT_WITH_POINT_STATE 1`] = ` -Map { - "ShadowNodes.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateShadowNodeH.js - */ - -#pragma once - -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -JSI_EXPORT extern const char SimpleComponentComponentName[]; - -/* - * \`ShadowNode\` for component. - */ -using SimpleComponentShadowNode = ConcreteViewShadowNode< - SimpleComponentComponentName, - SimpleComponentProps, - SimpleComponentEventEmitter, - SimpleComponentState>; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateShadowNodeH can generate fixture COMPONENT_WITH_STRING_ENUM_STATE_PROPS 1`] = ` -Map { - "ShadowNodes.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateShadowNodeH.js - */ - -#pragma once - -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -JSI_EXPORT extern const char SimpleComponentComponentName[]; - -/* - * \`ShadowNode\` for component. - */ -using SimpleComponentShadowNode = ConcreteViewShadowNode< - SimpleComponentComponentName, - SimpleComponentProps, - SimpleComponentEventEmitter, - SimpleComponentState>; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateShadowNodeH can generate fixture COMPONENT_WITH_STRING_STATE 1`] = ` -Map { - "ShadowNodes.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateShadowNodeH.js - */ - -#pragma once - -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -JSI_EXPORT extern const char SimpleComponentComponentName[]; - -/* - * \`ShadowNode\` for component. - */ -using SimpleComponentShadowNode = ConcreteViewShadowNode< - SimpleComponentComponentName, - SimpleComponentProps, - SimpleComponentEventEmitter, - SimpleComponentState>; - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateShadowNodeH can generate fixture COMPONENTS_WITH_IMAGES_IN_STATE 1`] = ` -Map { - "ShadowNodes.h" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateShadowNodeH.js - */ - -#pragma once - -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -JSI_EXPORT extern const char SimpleComponentComponentName[]; - -/* - * \`ShadowNode\` for component. - */ -using SimpleComponentShadowNode = ConcreteViewShadowNode< - SimpleComponentComponentName, - SimpleComponentProps, - SimpleComponentEventEmitter, - SimpleComponentState>; - -} // namespace react -} // namespace facebook -", -} -`; - exports[`GenerateShadowNodeH can generate fixture DOUBLE_PROPS 1`] = ` Map { "ShadowNodes.h" => " diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateStateCpp-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateStateCpp-test.js.snap index b9dd5fe9965663..04084fb1b5a050 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateStateCpp-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateStateCpp-test.js.snap @@ -138,468 +138,6 @@ namespace react { -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateStateCpp can generate fixture COMPONENT_WITH_ARRAY_OF_OBJECTS_STATE 1`] = ` -Map { - "States.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateStateCpp.js - */ -#include - -namespace facebook { -namespace react { - -std::vector SimpleComponentState::getArrayState() const { - return arrayState_; -} - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateStateCpp can generate fixture COMPONENT_WITH_ARRAY_STATE 1`] = ` -Map { - "States.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateStateCpp.js - */ -#include - -namespace facebook { -namespace react { - -std::vector SimpleComponentState::getNames() const { - return names_; -} - -std::vector SimpleComponentState::getDisableds() const { - return disableds_; -} - -std::vector SimpleComponentState::getProgress() const { - return progress_; -} - -std::vector SimpleComponentState::getRadii() const { - return radii_; -} - -std::vector SimpleComponentState::getColors() const { - return colors_; -} - -std::vector SimpleComponentState::getSrcs() const { - return srcs_; -} - -std::vector SimpleComponentState::getPoints() const { - return points_; -} - -SimpleComponentSizesMask SimpleComponentState::getSizes() const { - return sizes_; -} - -std::vector SimpleComponentState::getObject() const { - return object_; -} - -std::vector SimpleComponentState::getArray() const { - return array_; -} - -std::vector> SimpleComponentState::getArrayOfArrayOfObject() const { - return arrayOfArrayOfObject_; -} - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateStateCpp can generate fixture COMPONENT_WITH_BOOL_STATE 1`] = ` -Map { - "States.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateStateCpp.js - */ -#include - -namespace facebook { -namespace react { - -bool SimpleComponentState::getDisabled() const { - return disabled_; -} - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateStateCpp can generate fixture COMPONENT_WITH_COLOR_STATE 1`] = ` -Map { - "States.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateStateCpp.js - */ -#include - -namespace facebook { -namespace react { - -SharedColor SimpleComponentState::getTintColor() const { - return tintColor_; -} - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateStateCpp can generate fixture COMPONENT_WITH_DOUBLE_STATE 1`] = ` -Map { - "States.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateStateCpp.js - */ -#include - -namespace facebook { -namespace react { - -double SimpleComponentState::getD_blurRadius() const { - return d_blurRadius_; -} - -double SimpleComponentState::getD_blurRadius2() const { - return d_blurRadius2_; -} - -double SimpleComponentState::getD_blurRadius3() const { - return d_blurRadius3_; -} - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateStateCpp can generate fixture COMPONENT_WITH_EDGE_INSET_STATE_PROPS 1`] = ` -Map { - "States.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateStateCpp.js - */ -#include - -namespace facebook { -namespace react { - -EdgeInsets SimpleComponentState::getContentInset() const { - return contentInset_; -} - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateStateCpp can generate fixture COMPONENT_WITH_FLOAT_STATE 1`] = ` -Map { - "States.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateStateCpp.js - */ -#include - -namespace facebook { -namespace react { - -Float SimpleComponentState::getBlurRadius() const { - return blurRadius_; -} - -Float SimpleComponentState::getBlurRadius2() const { - return blurRadius2_; -} - -Float SimpleComponentState::getBlurRadius3() const { - return blurRadius3_; -} - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateStateCpp can generate fixture COMPONENT_WITH_IMAGE_STATE 1`] = ` -Map { - "States.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateStateCpp.js - */ -#include - -namespace facebook { -namespace react { - -ImageSource SimpleComponentState::getThumbImage() const { - return thumbImage_; -} - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateStateCpp can generate fixture COMPONENT_WITH_INT_ENUM_STATE 1`] = ` -Map { - "States.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateStateCpp.js - */ -#include - -namespace facebook { -namespace react { - -SimpleComponentMaxInterval SimpleComponentState::getMaxInterval() const { - return maxInterval_; -} - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateStateCpp can generate fixture COMPONENT_WITH_INT_STATE 1`] = ` -Map { - "States.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateStateCpp.js - */ -#include - -namespace facebook { -namespace react { - -int SimpleComponentState::getProgress1() const { - return progress1_; -} - -int SimpleComponentState::getProgress2() const { - return progress2_; -} - -int SimpleComponentState::getProgress3() const { - return progress3_; -} - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateStateCpp can generate fixture COMPONENT_WITH_OBJECT_STATE 1`] = ` -Map { - "States.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateStateCpp.js - */ -#include - -namespace facebook { -namespace react { - -SimpleComponentObjectPropStruct SimpleComponentState::getObjectProp() const { - return objectProp_; -} - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateStateCpp can generate fixture COMPONENT_WITH_POINT_STATE 1`] = ` -Map { - "States.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateStateCpp.js - */ -#include - -namespace facebook { -namespace react { - -Point SimpleComponentState::getStartPoint() const { - return startPoint_; -} - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateStateCpp can generate fixture COMPONENT_WITH_STRING_ENUM_STATE_PROPS 1`] = ` -Map { - "States.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateStateCpp.js - */ -#include - -namespace facebook { -namespace react { - -SimpleComponentAlignment SimpleComponentState::getAlignment() const { - return alignment_; -} - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateStateCpp can generate fixture COMPONENT_WITH_STRING_STATE 1`] = ` -Map { - "States.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateStateCpp.js - */ -#include - -namespace facebook { -namespace react { - -std::string SimpleComponentState::getAccessibilityHint() const { - return accessibilityHint_; -} - -std::string SimpleComponentState::getAccessibilityRole() const { - return accessibilityRole_; -} - -} // namespace react -} // namespace facebook -", -} -`; - -exports[`GenerateStateCpp can generate fixture COMPONENTS_WITH_IMAGES_IN_STATE 1`] = ` -Map { - "States.cpp" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateStateCpp.js - */ -#include - -namespace facebook { -namespace react { - -ImageSource SimpleComponentState::getImageSource() const { - return imageSource_; -} - -ImageRequest const & SimpleComponentState::getImageRequest() const { - return *imageRequest_; -} - } // namespace react } // namespace facebook ", diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateStateH-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateStateH-test.js.snap index 3a938546f47813..a0bb2f075a0ac9 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateStateH-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateStateH-test.js.snap @@ -12,902 +12,21 @@ Map { */ #pragma once -#include - -#ifdef ANDROID -#include -#include -#include -#endif - - - -namespace facebook { -namespace react { - -class ArrayPropsNativeComponentState { -public: - - ArrayPropsNativeComponentState() = default; - - - -#ifdef ANDROID - ArrayPropsNativeComponentState(ArrayPropsNativeComponentState const &previousState, folly::dynamic data){}; - folly::dynamic getDynamic() const { - return {}; - }; - MapBuffer getMapBuffer() const { - return MapBufferBuilder::EMPTY(); - }; -#endif - -private: - -}; - -} // namespace react -} // namespace facebook", -} -`; - -exports[`GenerateStateH can generate fixture ARRAY_PROPS_WITH_NESTED_OBJECT 1`] = ` -Map { - "States.h" => "/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateStateH.js - */ -#pragma once - -#include - -#ifdef ANDROID -#include -#include -#include -#endif - - - -namespace facebook { -namespace react { - -class ArrayPropsNativeComponentState { -public: - - ArrayPropsNativeComponentState() = default; - - - -#ifdef ANDROID - ArrayPropsNativeComponentState(ArrayPropsNativeComponentState const &previousState, folly::dynamic data){}; - folly::dynamic getDynamic() const { - return {}; - }; - MapBuffer getMapBuffer() const { - return MapBufferBuilder::EMPTY(); - }; -#endif - -private: - -}; - -} // namespace react -} // namespace facebook", -} -`; - -exports[`GenerateStateH can generate fixture BOOLEAN_PROP 1`] = ` -Map { - "States.h" => "/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateStateH.js - */ -#pragma once - -#include - -#ifdef ANDROID -#include -#include -#include -#endif - - - -namespace facebook { -namespace react { - -class BooleanPropNativeComponentState { -public: - - BooleanPropNativeComponentState() = default; - - - -#ifdef ANDROID - BooleanPropNativeComponentState(BooleanPropNativeComponentState const &previousState, folly::dynamic data){}; - folly::dynamic getDynamic() const { - return {}; - }; - MapBuffer getMapBuffer() const { - return MapBufferBuilder::EMPTY(); - }; -#endif - -private: - -}; - -} // namespace react -} // namespace facebook", -} -`; - -exports[`GenerateStateH can generate fixture COLOR_PROP 1`] = ` -Map { - "States.h" => "/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateStateH.js - */ -#pragma once - -#include - -#ifdef ANDROID -#include -#include -#include -#endif - - - -namespace facebook { -namespace react { - -class ColorPropNativeComponentState { -public: - - ColorPropNativeComponentState() = default; - - - -#ifdef ANDROID - ColorPropNativeComponentState(ColorPropNativeComponentState const &previousState, folly::dynamic data){}; - folly::dynamic getDynamic() const { - return {}; - }; - MapBuffer getMapBuffer() const { - return MapBufferBuilder::EMPTY(); - }; -#endif - -private: - -}; - -} // namespace react -} // namespace facebook", -} -`; - -exports[`GenerateStateH can generate fixture COMMANDS 1`] = ` -Map { - "States.h" => "/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateStateH.js - */ -#pragma once - -#include - -#ifdef ANDROID -#include -#include -#include -#endif - - - -namespace facebook { -namespace react { - -class CommandNativeComponentState { -public: - - CommandNativeComponentState() = default; - - - -#ifdef ANDROID - CommandNativeComponentState(CommandNativeComponentState const &previousState, folly::dynamic data){}; - folly::dynamic getDynamic() const { - return {}; - }; - MapBuffer getMapBuffer() const { - return MapBufferBuilder::EMPTY(); - }; -#endif - -private: - -}; - -} // namespace react -} // namespace facebook", -} -`; - -exports[`GenerateStateH can generate fixture COMMANDS_AND_PROPS 1`] = ` -Map { - "States.h" => "/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateStateH.js - */ -#pragma once - -#include - -#ifdef ANDROID -#include -#include -#include -#endif - - - -namespace facebook { -namespace react { - -class CommandNativeComponentState { -public: - - CommandNativeComponentState() = default; - - - -#ifdef ANDROID - CommandNativeComponentState(CommandNativeComponentState const &previousState, folly::dynamic data){}; - folly::dynamic getDynamic() const { - return {}; - }; - MapBuffer getMapBuffer() const { - return MapBufferBuilder::EMPTY(); - }; -#endif - -private: - -}; - -} // namespace react -} // namespace facebook", -} -`; - -exports[`GenerateStateH can generate fixture COMPONENT_WITH_ARRAY_OF_OBJECTS_STATE 1`] = ` -Map { - "States.h" => "/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateStateH.js - */ -#pragma once - -#include - -#ifdef ANDROID -#include -#include -#include -#endif - -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -class SimpleComponentState { -public: - SimpleComponentState( - std::vector arrayState) - : arrayState_(arrayState){}; - SimpleComponentState() = default; - - std::vector getArrayState() const; - - -#ifdef ANDROID - SimpleComponentState(SimpleComponentState const &previousState, folly::dynamic data){}; - folly::dynamic getDynamic() const { - return {}; - }; - MapBuffer getMapBuffer() const { - return MapBufferBuilder::EMPTY(); - }; -#endif - -private: - std::vector arrayState_; - -}; - -} // namespace react -} // namespace facebook", -} -`; - -exports[`GenerateStateH can generate fixture COMPONENT_WITH_ARRAY_STATE 1`] = ` -Map { - "States.h" => "/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateStateH.js - */ -#pragma once - -#include - -#ifdef ANDROID -#include -#include -#include -#endif - -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -class SimpleComponentState { -public: - SimpleComponentState( - std::vector names, - std::vector disableds, - std::vector progress, - std::vector radii, - std::vector colors, - std::vector srcs, - std::vector points, - SimpleComponentSizesMask sizes, - std::vector object, - std::vector array, - std::vector> arrayOfArrayOfObject) - : names_(names), - disableds_(disableds), - progress_(progress), - radii_(radii), - colors_(colors), - srcs_(srcs), - points_(points), - sizes_(sizes), - object_(object), - array_(array), - arrayOfArrayOfObject_(arrayOfArrayOfObject){}; - SimpleComponentState() = default; - - std::vector getNames() const; - std::vector getDisableds() const; - std::vector getProgress() const; - std::vector getRadii() const; - std::vector getColors() const; - std::vector getSrcs() const; - std::vector getPoints() const; - SimpleComponentSizesMask getSizes() const; - std::vector getObject() const; - std::vector getArray() const; - std::vector> getArrayOfArrayOfObject() const; - - -#ifdef ANDROID - SimpleComponentState(SimpleComponentState const &previousState, folly::dynamic data){}; - folly::dynamic getDynamic() const { - return {}; - }; - MapBuffer getMapBuffer() const { - return MapBufferBuilder::EMPTY(); - }; -#endif - -private: - std::vector names_; - std::vector disableds_; - std::vector progress_; - std::vector radii_; - std::vector colors_; - std::vector srcs_; - std::vector points_; - SimpleComponentSizesMask sizes_{static_cast(SimpleComponentSizes::Small)}; - std::vector object_; - std::vector array_; - std::vector> arrayOfArrayOfObject_; - -}; - -} // namespace react -} // namespace facebook", -} -`; - -exports[`GenerateStateH can generate fixture COMPONENT_WITH_BOOL_STATE 1`] = ` -Map { - "States.h" => "/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateStateH.js - */ -#pragma once - -#include - -#ifdef ANDROID -#include -#include -#include -#endif - - - -namespace facebook { -namespace react { - -class SimpleComponentState { -public: - SimpleComponentState( - bool disabled) - : disabled_(disabled){}; - SimpleComponentState() = default; - - bool getDisabled() const; - - -#ifdef ANDROID - SimpleComponentState(SimpleComponentState const &previousState, folly::dynamic data){}; - folly::dynamic getDynamic() const { - return {}; - }; - MapBuffer getMapBuffer() const { - return MapBufferBuilder::EMPTY(); - }; -#endif - -private: - bool disabled_{false}; - -}; - -} // namespace react -} // namespace facebook", -} -`; - -exports[`GenerateStateH can generate fixture COMPONENT_WITH_COLOR_STATE 1`] = ` -Map { - "States.h" => "/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateStateH.js - */ -#pragma once - -#include - -#ifdef ANDROID -#include -#include -#include -#endif - -#include - -namespace facebook { -namespace react { - -class SimpleComponentState { -public: - SimpleComponentState( - SharedColor tintColor) - : tintColor_(tintColor){}; - SimpleComponentState() = default; - - SharedColor getTintColor() const; - - -#ifdef ANDROID - SimpleComponentState(SimpleComponentState const &previousState, folly::dynamic data){}; - folly::dynamic getDynamic() const { - return {}; - }; - MapBuffer getMapBuffer() const { - return MapBufferBuilder::EMPTY(); - }; -#endif - -private: - SharedColor tintColor_; - -}; - -} // namespace react -} // namespace facebook", -} -`; - -exports[`GenerateStateH can generate fixture COMPONENT_WITH_DOUBLE_STATE 1`] = ` -Map { - "States.h" => "/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateStateH.js - */ -#pragma once - -#include - -#ifdef ANDROID -#include -#include -#include -#endif - - - -namespace facebook { -namespace react { - -class SimpleComponentState { -public: - SimpleComponentState( - double d_blurRadius, - double d_blurRadius2, - double d_blurRadius3) - : d_blurRadius_(d_blurRadius), - d_blurRadius2_(d_blurRadius2), - d_blurRadius3_(d_blurRadius3){}; - SimpleComponentState() = default; - - double getD_blurRadius() const; - double getD_blurRadius2() const; - double getD_blurRadius3() const; - - -#ifdef ANDROID - SimpleComponentState(SimpleComponentState const &previousState, folly::dynamic data){}; - folly::dynamic getDynamic() const { - return {}; - }; - MapBuffer getMapBuffer() const { - return MapBufferBuilder::EMPTY(); - }; -#endif - -private: - double d_blurRadius_{0.0}; - double d_blurRadius2_{8.9}; - double d_blurRadius3_{-0.5}; - -}; - -} // namespace react -} // namespace facebook", -} -`; - -exports[`GenerateStateH can generate fixture COMPONENT_WITH_EDGE_INSET_STATE_PROPS 1`] = ` -Map { - "States.h" => "/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateStateH.js - */ -#pragma once - -#include - -#ifdef ANDROID -#include -#include -#include -#endif - -#include - -namespace facebook { -namespace react { - -class SimpleComponentState { -public: - SimpleComponentState( - EdgeInsets contentInset) - : contentInset_(contentInset){}; - SimpleComponentState() = default; - - EdgeInsets getContentInset() const; - - -#ifdef ANDROID - SimpleComponentState(SimpleComponentState const &previousState, folly::dynamic data){}; - folly::dynamic getDynamic() const { - return {}; - }; - MapBuffer getMapBuffer() const { - return MapBufferBuilder::EMPTY(); - }; -#endif - -private: - EdgeInsets contentInset_; - -}; - -} // namespace react -} // namespace facebook", -} -`; - -exports[`GenerateStateH can generate fixture COMPONENT_WITH_FLOAT_STATE 1`] = ` -Map { - "States.h" => "/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateStateH.js - */ -#pragma once - -#include - -#ifdef ANDROID -#include -#include -#include -#endif - - - -namespace facebook { -namespace react { - -class SimpleComponentState { -public: - SimpleComponentState( - Float blurRadius, - Float blurRadius2, - Float blurRadius3) - : blurRadius_(blurRadius), - blurRadius2_(blurRadius2), - blurRadius3_(blurRadius3){}; - SimpleComponentState() = default; - - Float getBlurRadius() const; - Float getBlurRadius2() const; - Float getBlurRadius3() const; - - -#ifdef ANDROID - SimpleComponentState(SimpleComponentState const &previousState, folly::dynamic data){}; - folly::dynamic getDynamic() const { - return {}; - }; - MapBuffer getMapBuffer() const { - return MapBufferBuilder::EMPTY(); - }; -#endif - -private: - Float blurRadius_{0.0}; - Float blurRadius2_{7.5}; - Float blurRadius3_{-2.1}; - -}; - -} // namespace react -} // namespace facebook", -} -`; - -exports[`GenerateStateH can generate fixture COMPONENT_WITH_IMAGE_STATE 1`] = ` -Map { - "States.h" => "/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateStateH.js - */ -#pragma once - -#include - -#ifdef ANDROID -#include -#include -#include -#endif - -#include - -namespace facebook { -namespace react { - -class SimpleComponentState { -public: - SimpleComponentState( - ImageSource const & thumbImage) - : thumbImage_(thumbImage){}; - SimpleComponentState() = default; - - ImageSource getThumbImage() const; - - -#ifdef ANDROID - SimpleComponentState(SimpleComponentState const &previousState, folly::dynamic data){}; - folly::dynamic getDynamic() const { - return {}; - }; - MapBuffer getMapBuffer() const { - return MapBufferBuilder::EMPTY(); - }; -#endif - -private: - ImageSource thumbImage_; - -}; - -} // namespace react -} // namespace facebook", -} -`; - -exports[`GenerateStateH can generate fixture COMPONENT_WITH_INT_ENUM_STATE 1`] = ` -Map { - "States.h" => "/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateStateH.js - */ -#pragma once - -#include - -#ifdef ANDROID -#include -#include -#include -#endif - - - -namespace facebook { -namespace react { - -class SimpleComponentState { -public: - SimpleComponentState( - SimpleComponentMaxInterval maxInterval) - : maxInterval_(maxInterval){}; - SimpleComponentState() = default; - - SimpleComponentMaxInterval getMaxInterval() const; - - -#ifdef ANDROID - SimpleComponentState(SimpleComponentState const &previousState, folly::dynamic data){}; - folly::dynamic getDynamic() const { - return {}; - }; - MapBuffer getMapBuffer() const { - return MapBufferBuilder::EMPTY(); - }; -#endif - -private: - SimpleComponentMaxInterval maxInterval_{SimpleComponentMaxInterval::MaxInterval0}; - -}; - -} // namespace react -} // namespace facebook", -} -`; - -exports[`GenerateStateH can generate fixture COMPONENT_WITH_INT_STATE 1`] = ` -Map { - "States.h" => "/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateStateH.js - */ -#pragma once - -#include - #ifdef ANDROID #include #include #include #endif - - namespace facebook { namespace react { -class SimpleComponentState { +class ArrayPropsNativeComponentState { public: - SimpleComponentState( - int progress1, - int progress2, - int progress3) - : progress1_(progress1), - progress2_(progress2), - progress3_(progress3){}; - SimpleComponentState() = default; - - int getProgress1() const; - int getProgress2() const; - int getProgress3() const; - + ArrayPropsNativeComponentState() = default; #ifdef ANDROID - SimpleComponentState(SimpleComponentState const &previousState, folly::dynamic data){}; + ArrayPropsNativeComponentState(ArrayPropsNativeComponentState const &previousState, folly::dynamic data){}; folly::dynamic getDynamic() const { return {}; }; @@ -915,12 +34,6 @@ public: return MapBufferBuilder::EMPTY(); }; #endif - -private: - int progress1_{0}; - int progress2_{-1}; - int progress3_{10}; - }; } // namespace react @@ -928,7 +41,7 @@ private: } `; -exports[`GenerateStateH can generate fixture COMPONENT_WITH_OBJECT_STATE 1`] = ` +exports[`GenerateStateH can generate fixture ARRAY_PROPS_WITH_NESTED_OBJECT 1`] = ` Map { "States.h" => "/** * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). @@ -940,36 +53,21 @@ Map { */ #pragma once -#include - #ifdef ANDROID #include #include #include #endif -#include -#include -#include -#include -#include -#include - namespace facebook { namespace react { -class SimpleComponentState { +class ArrayPropsNativeComponentState { public: - SimpleComponentState( - SimpleComponentObjectPropStruct objectProp) - : objectProp_(objectProp){}; - SimpleComponentState() = default; - - SimpleComponentObjectPropStruct getObjectProp() const; - + ArrayPropsNativeComponentState() = default; #ifdef ANDROID - SimpleComponentState(SimpleComponentState const &previousState, folly::dynamic data){}; + ArrayPropsNativeComponentState(ArrayPropsNativeComponentState const &previousState, folly::dynamic data){}; folly::dynamic getDynamic() const { return {}; }; @@ -977,10 +75,6 @@ public: return MapBufferBuilder::EMPTY(); }; #endif - -private: - SimpleComponentObjectPropStruct objectProp_; - }; } // namespace react @@ -988,7 +82,7 @@ private: } `; -exports[`GenerateStateH can generate fixture COMPONENT_WITH_POINT_STATE 1`] = ` +exports[`GenerateStateH can generate fixture BOOLEAN_PROP 1`] = ` Map { "States.h" => "/** * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). @@ -1000,31 +94,21 @@ Map { */ #pragma once -#include - #ifdef ANDROID #include #include #include #endif -#include - namespace facebook { namespace react { -class SimpleComponentState { +class BooleanPropNativeComponentState { public: - SimpleComponentState( - Point startPoint) - : startPoint_(startPoint){}; - SimpleComponentState() = default; - - Point getStartPoint() const; - + BooleanPropNativeComponentState() = default; #ifdef ANDROID - SimpleComponentState(SimpleComponentState const &previousState, folly::dynamic data){}; + BooleanPropNativeComponentState(BooleanPropNativeComponentState const &previousState, folly::dynamic data){}; folly::dynamic getDynamic() const { return {}; }; @@ -1032,10 +116,6 @@ public: return MapBufferBuilder::EMPTY(); }; #endif - -private: - Point startPoint_; - }; } // namespace react @@ -1043,7 +123,7 @@ private: } `; -exports[`GenerateStateH can generate fixture COMPONENT_WITH_STRING_ENUM_STATE_PROPS 1`] = ` +exports[`GenerateStateH can generate fixture COLOR_PROP 1`] = ` Map { "States.h" => "/** * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). @@ -1055,31 +135,21 @@ Map { */ #pragma once -#include - #ifdef ANDROID #include #include #include #endif - - namespace facebook { namespace react { -class SimpleComponentState { +class ColorPropNativeComponentState { public: - SimpleComponentState( - SimpleComponentAlignment alignment) - : alignment_(alignment){}; - SimpleComponentState() = default; - - SimpleComponentAlignment getAlignment() const; - + ColorPropNativeComponentState() = default; #ifdef ANDROID - SimpleComponentState(SimpleComponentState const &previousState, folly::dynamic data){}; + ColorPropNativeComponentState(ColorPropNativeComponentState const &previousState, folly::dynamic data){}; folly::dynamic getDynamic() const { return {}; }; @@ -1087,10 +157,6 @@ public: return MapBufferBuilder::EMPTY(); }; #endif - -private: - SimpleComponentAlignment alignment_{SimpleComponentAlignment::Center}; - }; } // namespace react @@ -1098,7 +164,7 @@ private: } `; -exports[`GenerateStateH can generate fixture COMPONENT_WITH_STRING_STATE 1`] = ` +exports[`GenerateStateH can generate fixture COMMANDS 1`] = ` Map { "States.h" => "/** * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). @@ -1110,34 +176,21 @@ Map { */ #pragma once -#include - #ifdef ANDROID #include #include #include #endif - - namespace facebook { namespace react { -class SimpleComponentState { +class CommandNativeComponentState { public: - SimpleComponentState( - std::string accessibilityHint, - std::string accessibilityRole) - : accessibilityHint_(accessibilityHint), - accessibilityRole_(accessibilityRole){}; - SimpleComponentState() = default; - - std::string getAccessibilityHint() const; - std::string getAccessibilityRole() const; - + CommandNativeComponentState() = default; #ifdef ANDROID - SimpleComponentState(SimpleComponentState const &previousState, folly::dynamic data){}; + CommandNativeComponentState(CommandNativeComponentState const &previousState, folly::dynamic data){}; folly::dynamic getDynamic() const { return {}; }; @@ -1145,11 +198,6 @@ public: return MapBufferBuilder::EMPTY(); }; #endif - -private: - std::string accessibilityHint_{\\"\\"}; - std::string accessibilityRole_; - }; } // namespace react @@ -1157,7 +205,7 @@ private: } `; -exports[`GenerateStateH can generate fixture COMPONENTS_WITH_IMAGES_IN_STATE 1`] = ` +exports[`GenerateStateH can generate fixture COMMANDS_AND_PROPS 1`] = ` Map { "States.h" => "/** * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). @@ -1169,35 +217,21 @@ Map { */ #pragma once -#include - #ifdef ANDROID #include #include #include #endif -#include -#include - namespace facebook { namespace react { -class SimpleComponentState { +class CommandNativeComponentState { public: - SimpleComponentState( - ImageSource const & imageSource, - ImageRequest imageRequest) - : imageSource_(imageSource), - imageRequest_(std::make_shared(std::move(imageRequest))){}; - SimpleComponentState() = default; - - ImageSource getImageSource() const; - ImageRequest const & getImageRequest() const; - + CommandNativeComponentState() = default; #ifdef ANDROID - SimpleComponentState(SimpleComponentState const &previousState, folly::dynamic data){}; + CommandNativeComponentState(CommandNativeComponentState const &previousState, folly::dynamic data){}; folly::dynamic getDynamic() const { return {}; }; @@ -1205,11 +239,6 @@ public: return MapBufferBuilder::EMPTY(); }; #endif - -private: - ImageSource imageSource_; - std::shared_ptr imageRequest_; - }; } // namespace react @@ -1229,26 +258,19 @@ Map { */ #pragma once -#include - #ifdef ANDROID #include #include #include #endif - - namespace facebook { namespace react { class DoublePropNativeComponentState { public: - DoublePropNativeComponentState() = default; - - #ifdef ANDROID DoublePropNativeComponentState(DoublePropNativeComponentState const &previousState, folly::dynamic data){}; folly::dynamic getDynamic() const { @@ -1258,9 +280,6 @@ public: return MapBufferBuilder::EMPTY(); }; #endif - -private: - }; } // namespace react @@ -1280,26 +299,19 @@ Map { */ #pragma once -#include - #ifdef ANDROID #include #include #include #endif - - namespace facebook { namespace react { class EventsNestedObjectNativeComponentState { public: - EventsNestedObjectNativeComponentState() = default; - - #ifdef ANDROID EventsNestedObjectNativeComponentState(EventsNestedObjectNativeComponentState const &previousState, folly::dynamic data){}; folly::dynamic getDynamic() const { @@ -1309,9 +321,6 @@ public: return MapBufferBuilder::EMPTY(); }; #endif - -private: - }; } // namespace react @@ -1331,26 +340,19 @@ Map { */ #pragma once -#include - #ifdef ANDROID #include #include #include #endif - - namespace facebook { namespace react { class EventsNativeComponentState { public: - EventsNativeComponentState() = default; - - #ifdef ANDROID EventsNativeComponentState(EventsNativeComponentState const &previousState, folly::dynamic data){}; folly::dynamic getDynamic() const { @@ -1360,9 +362,6 @@ public: return MapBufferBuilder::EMPTY(); }; #endif - -private: - }; } // namespace react @@ -1382,16 +381,12 @@ Map { */ #pragma once -#include - #ifdef ANDROID #include #include #include #endif - - namespace facebook { namespace react { @@ -1414,26 +409,19 @@ Map { */ #pragma once -#include - #ifdef ANDROID #include #include #include #endif - - namespace facebook { namespace react { class ExcludedAndroidComponentState { public: - ExcludedAndroidComponentState() = default; - - #ifdef ANDROID ExcludedAndroidComponentState(ExcludedAndroidComponentState const &previousState, folly::dynamic data){}; folly::dynamic getDynamic() const { @@ -1443,9 +431,6 @@ public: return MapBufferBuilder::EMPTY(); }; #endif - -private: - }; } // namespace react @@ -1465,26 +450,19 @@ Map { */ #pragma once -#include - #ifdef ANDROID #include #include #include #endif - - namespace facebook { namespace react { class ExcludedAndroidIosComponentState { public: - ExcludedAndroidIosComponentState() = default; - - #ifdef ANDROID ExcludedAndroidIosComponentState(ExcludedAndroidIosComponentState const &previousState, folly::dynamic data){}; folly::dynamic getDynamic() const { @@ -1494,9 +472,6 @@ public: return MapBufferBuilder::EMPTY(); }; #endif - -private: - }; } // namespace react @@ -1516,26 +491,19 @@ Map { */ #pragma once -#include - #ifdef ANDROID #include #include #include #endif - - namespace facebook { namespace react { class ExcludedIosComponentState { public: - ExcludedIosComponentState() = default; - - #ifdef ANDROID ExcludedIosComponentState(ExcludedIosComponentState const &previousState, folly::dynamic data){}; folly::dynamic getDynamic() const { @@ -1545,18 +513,12 @@ public: return MapBufferBuilder::EMPTY(); }; #endif - -private: - }; class MultiFileIncludedNativeComponentState { public: - MultiFileIncludedNativeComponentState() = default; - - #ifdef ANDROID MultiFileIncludedNativeComponentState(MultiFileIncludedNativeComponentState const &previousState, folly::dynamic data){}; folly::dynamic getDynamic() const { @@ -1566,9 +528,6 @@ public: return MapBufferBuilder::EMPTY(); }; #endif - -private: - }; } // namespace react @@ -1588,26 +547,19 @@ Map { */ #pragma once -#include - #ifdef ANDROID #include #include #include #endif - - namespace facebook { namespace react { class FloatPropNativeComponentState { public: - FloatPropNativeComponentState() = default; - - #ifdef ANDROID FloatPropNativeComponentState(FloatPropNativeComponentState const &previousState, folly::dynamic data){}; folly::dynamic getDynamic() const { @@ -1617,9 +569,6 @@ public: return MapBufferBuilder::EMPTY(); }; #endif - -private: - }; } // namespace react @@ -1639,26 +588,19 @@ Map { */ #pragma once -#include - #ifdef ANDROID #include #include #include #endif - - namespace facebook { namespace react { class ImagePropNativeComponentState { public: - ImagePropNativeComponentState() = default; - - #ifdef ANDROID ImagePropNativeComponentState(ImagePropNativeComponentState const &previousState, folly::dynamic data){}; folly::dynamic getDynamic() const { @@ -1668,9 +610,6 @@ public: return MapBufferBuilder::EMPTY(); }; #endif - -private: - }; } // namespace react @@ -1690,26 +629,19 @@ Map { */ #pragma once -#include - #ifdef ANDROID #include #include #include #endif - - namespace facebook { namespace react { class InsetsPropNativeComponentState { public: - InsetsPropNativeComponentState() = default; - - #ifdef ANDROID InsetsPropNativeComponentState(InsetsPropNativeComponentState const &previousState, folly::dynamic data){}; folly::dynamic getDynamic() const { @@ -1719,9 +651,6 @@ public: return MapBufferBuilder::EMPTY(); }; #endif - -private: - }; } // namespace react @@ -1741,26 +670,19 @@ Map { */ #pragma once -#include - #ifdef ANDROID #include #include #include #endif - - namespace facebook { namespace react { class Int32EnumPropsNativeComponentState { public: - Int32EnumPropsNativeComponentState() = default; - - #ifdef ANDROID Int32EnumPropsNativeComponentState(Int32EnumPropsNativeComponentState const &previousState, folly::dynamic data){}; folly::dynamic getDynamic() const { @@ -1770,9 +692,6 @@ public: return MapBufferBuilder::EMPTY(); }; #endif - -private: - }; } // namespace react @@ -1792,26 +711,19 @@ Map { */ #pragma once -#include - #ifdef ANDROID #include #include #include #endif - - namespace facebook { namespace react { class IntegerPropNativeComponentState { public: - IntegerPropNativeComponentState() = default; - - #ifdef ANDROID IntegerPropNativeComponentState(IntegerPropNativeComponentState const &previousState, folly::dynamic data){}; folly::dynamic getDynamic() const { @@ -1821,9 +733,6 @@ public: return MapBufferBuilder::EMPTY(); }; #endif - -private: - }; } // namespace react @@ -1843,16 +752,12 @@ Map { */ #pragma once -#include - #ifdef ANDROID #include #include #include #endif - - namespace facebook { namespace react { @@ -1875,26 +780,19 @@ Map { */ #pragma once -#include - #ifdef ANDROID #include #include #include #endif - - namespace facebook { namespace react { class ImageColorPropNativeComponentState { public: - ImageColorPropNativeComponentState() = default; - - #ifdef ANDROID ImageColorPropNativeComponentState(ImageColorPropNativeComponentState const &previousState, folly::dynamic data){}; folly::dynamic getDynamic() const { @@ -1904,9 +802,6 @@ public: return MapBufferBuilder::EMPTY(); }; #endif - -private: - }; } // namespace react @@ -1926,26 +821,19 @@ Map { */ #pragma once -#include - #ifdef ANDROID #include #include #include #endif - - namespace facebook { namespace react { class NoPropsNoEventsComponentState { public: - NoPropsNoEventsComponentState() = default; - - #ifdef ANDROID NoPropsNoEventsComponentState(NoPropsNoEventsComponentState const &previousState, folly::dynamic data){}; folly::dynamic getDynamic() const { @@ -1955,9 +843,6 @@ public: return MapBufferBuilder::EMPTY(); }; #endif - -private: - }; } // namespace react @@ -1977,26 +862,19 @@ Map { */ #pragma once -#include - #ifdef ANDROID #include #include #include #endif - - namespace facebook { namespace react { class ObjectPropsState { public: - ObjectPropsState() = default; - - #ifdef ANDROID ObjectPropsState(ObjectPropsState const &previousState, folly::dynamic data){}; folly::dynamic getDynamic() const { @@ -2006,9 +884,6 @@ public: return MapBufferBuilder::EMPTY(); }; #endif - -private: - }; } // namespace react @@ -2028,26 +903,19 @@ Map { */ #pragma once -#include - #ifdef ANDROID #include #include #include #endif - - namespace facebook { namespace react { class PointPropNativeComponentState { public: - PointPropNativeComponentState() = default; - - #ifdef ANDROID PointPropNativeComponentState(PointPropNativeComponentState const &previousState, folly::dynamic data){}; folly::dynamic getDynamic() const { @@ -2057,9 +925,6 @@ public: return MapBufferBuilder::EMPTY(); }; #endif - -private: - }; } // namespace react @@ -2079,26 +944,19 @@ Map { */ #pragma once -#include - #ifdef ANDROID #include #include #include #endif - - namespace facebook { namespace react { class StringEnumPropsNativeComponentState { public: - StringEnumPropsNativeComponentState() = default; - - #ifdef ANDROID StringEnumPropsNativeComponentState(StringEnumPropsNativeComponentState const &previousState, folly::dynamic data){}; folly::dynamic getDynamic() const { @@ -2108,9 +966,6 @@ public: return MapBufferBuilder::EMPTY(); }; #endif - -private: - }; } // namespace react @@ -2130,26 +985,19 @@ Map { */ #pragma once -#include - #ifdef ANDROID #include #include #include #endif - - namespace facebook { namespace react { class StringPropComponentState { public: - StringPropComponentState() = default; - - #ifdef ANDROID StringPropComponentState(StringPropComponentState const &previousState, folly::dynamic data){}; folly::dynamic getDynamic() const { @@ -2159,9 +1007,6 @@ public: return MapBufferBuilder::EMPTY(); }; #endif - -private: - }; } // namespace react @@ -2181,26 +1026,19 @@ Map { */ #pragma once -#include - #ifdef ANDROID #include #include #include #endif - - namespace facebook { namespace react { class MultiFile1NativeComponentState { public: - MultiFile1NativeComponentState() = default; - - #ifdef ANDROID MultiFile1NativeComponentState(MultiFile1NativeComponentState const &previousState, folly::dynamic data){}; folly::dynamic getDynamic() const { @@ -2210,18 +1048,12 @@ public: return MapBufferBuilder::EMPTY(); }; #endif - -private: - }; class MultiFile2NativeComponentState { public: - MultiFile2NativeComponentState() = default; - - #ifdef ANDROID MultiFile2NativeComponentState(MultiFile2NativeComponentState const &previousState, folly::dynamic data){}; folly::dynamic getDynamic() const { @@ -2231,9 +1063,6 @@ public: return MapBufferBuilder::EMPTY(); }; #endif - -private: - }; } // namespace react @@ -2253,26 +1082,19 @@ Map { */ #pragma once -#include - #ifdef ANDROID #include #include #include #endif - - namespace facebook { namespace react { class MultiComponent1NativeComponentState { public: - MultiComponent1NativeComponentState() = default; - - #ifdef ANDROID MultiComponent1NativeComponentState(MultiComponent1NativeComponentState const &previousState, folly::dynamic data){}; folly::dynamic getDynamic() const { @@ -2282,18 +1104,12 @@ public: return MapBufferBuilder::EMPTY(); }; #endif - -private: - }; class MultiComponent2NativeComponentState { public: - MultiComponent2NativeComponentState() = default; - - #ifdef ANDROID MultiComponent2NativeComponentState(MultiComponent2NativeComponentState const &previousState, folly::dynamic data){}; folly::dynamic getDynamic() const { @@ -2303,9 +1119,6 @@ public: return MapBufferBuilder::EMPTY(); }; #endif - -private: - }; } // namespace react diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateTests-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateTests-test.js.snap index 1c6de7812a63e1..e8f46ea1f10403 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateTests-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateTests-test.js.snap @@ -250,545 +250,6 @@ TEST(CommandNativeComponentProps_accessibilityHint, etc) { } `; -exports[`GenerateTests can generate fixture COMPONENT_WITH_ARRAY_OF_OBJECTS_STATE 1`] = ` -Map { - "Tests.cpp" => "/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateTests.js - * */ - -#include -#include -#include -#include -#include -#include - -using namespace facebook::react; - -TEST(SimpleComponentProps_DoesNotDie, etc) { - auto propParser = RawPropsParser(); - propParser.prepare(); - auto const &sourceProps = SimpleComponentProps(); - auto const &rawProps = RawProps(folly::dynamic::object(\\"xx_invalid_xx\\", \\"xx_invalid_xx\\")); - - ContextContainer contextContainer{}; - PropsParserContext parserContext{-1, contextContainer}; - - rawProps.parse(propParser, parserContext); - SimpleComponentProps(parserContext, sourceProps, rawProps); -}", -} -`; - -exports[`GenerateTests can generate fixture COMPONENT_WITH_ARRAY_STATE 1`] = ` -Map { - "Tests.cpp" => "/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateTests.js - * */ - -#include -#include -#include -#include -#include -#include - -using namespace facebook::react; - -TEST(SimpleComponentProps_DoesNotDie, etc) { - auto propParser = RawPropsParser(); - propParser.prepare(); - auto const &sourceProps = SimpleComponentProps(); - auto const &rawProps = RawProps(folly::dynamic::object(\\"xx_invalid_xx\\", \\"xx_invalid_xx\\")); - - ContextContainer contextContainer{}; - PropsParserContext parserContext{-1, contextContainer}; - - rawProps.parse(propParser, parserContext); - SimpleComponentProps(parserContext, sourceProps, rawProps); -}", -} -`; - -exports[`GenerateTests can generate fixture COMPONENT_WITH_BOOL_STATE 1`] = ` -Map { - "Tests.cpp" => "/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateTests.js - * */ - -#include -#include -#include -#include -#include -#include - -using namespace facebook::react; - -TEST(SimpleComponentProps_DoesNotDie, etc) { - auto propParser = RawPropsParser(); - propParser.prepare(); - auto const &sourceProps = SimpleComponentProps(); - auto const &rawProps = RawProps(folly::dynamic::object(\\"xx_invalid_xx\\", \\"xx_invalid_xx\\")); - - ContextContainer contextContainer{}; - PropsParserContext parserContext{-1, contextContainer}; - - rawProps.parse(propParser, parserContext); - SimpleComponentProps(parserContext, sourceProps, rawProps); -}", -} -`; - -exports[`GenerateTests can generate fixture COMPONENT_WITH_COLOR_STATE 1`] = ` -Map { - "Tests.cpp" => "/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateTests.js - * */ - -#include -#include -#include -#include -#include -#include - -using namespace facebook::react; - -TEST(SimpleComponentProps_DoesNotDie, etc) { - auto propParser = RawPropsParser(); - propParser.prepare(); - auto const &sourceProps = SimpleComponentProps(); - auto const &rawProps = RawProps(folly::dynamic::object(\\"xx_invalid_xx\\", \\"xx_invalid_xx\\")); - - ContextContainer contextContainer{}; - PropsParserContext parserContext{-1, contextContainer}; - - rawProps.parse(propParser, parserContext); - SimpleComponentProps(parserContext, sourceProps, rawProps); -}", -} -`; - -exports[`GenerateTests can generate fixture COMPONENT_WITH_DOUBLE_STATE 1`] = ` -Map { - "Tests.cpp" => "/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateTests.js - * */ - -#include -#include -#include -#include -#include -#include - -using namespace facebook::react; - -TEST(SimpleComponentProps_DoesNotDie, etc) { - auto propParser = RawPropsParser(); - propParser.prepare(); - auto const &sourceProps = SimpleComponentProps(); - auto const &rawProps = RawProps(folly::dynamic::object(\\"xx_invalid_xx\\", \\"xx_invalid_xx\\")); - - ContextContainer contextContainer{}; - PropsParserContext parserContext{-1, contextContainer}; - - rawProps.parse(propParser, parserContext); - SimpleComponentProps(parserContext, sourceProps, rawProps); -}", -} -`; - -exports[`GenerateTests can generate fixture COMPONENT_WITH_EDGE_INSET_STATE_PROPS 1`] = ` -Map { - "Tests.cpp" => "/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateTests.js - * */ - -#include -#include -#include -#include -#include -#include - -using namespace facebook::react; - -TEST(SimpleComponentProps_DoesNotDie, etc) { - auto propParser = RawPropsParser(); - propParser.prepare(); - auto const &sourceProps = SimpleComponentProps(); - auto const &rawProps = RawProps(folly::dynamic::object(\\"xx_invalid_xx\\", \\"xx_invalid_xx\\")); - - ContextContainer contextContainer{}; - PropsParserContext parserContext{-1, contextContainer}; - - rawProps.parse(propParser, parserContext); - SimpleComponentProps(parserContext, sourceProps, rawProps); -}", -} -`; - -exports[`GenerateTests can generate fixture COMPONENT_WITH_FLOAT_STATE 1`] = ` -Map { - "Tests.cpp" => "/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateTests.js - * */ - -#include -#include -#include -#include -#include -#include - -using namespace facebook::react; - -TEST(SimpleComponentProps_DoesNotDie, etc) { - auto propParser = RawPropsParser(); - propParser.prepare(); - auto const &sourceProps = SimpleComponentProps(); - auto const &rawProps = RawProps(folly::dynamic::object(\\"xx_invalid_xx\\", \\"xx_invalid_xx\\")); - - ContextContainer contextContainer{}; - PropsParserContext parserContext{-1, contextContainer}; - - rawProps.parse(propParser, parserContext); - SimpleComponentProps(parserContext, sourceProps, rawProps); -}", -} -`; - -exports[`GenerateTests can generate fixture COMPONENT_WITH_IMAGE_STATE 1`] = ` -Map { - "Tests.cpp" => "/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateTests.js - * */ - -#include -#include -#include -#include -#include -#include - -using namespace facebook::react; - -TEST(SimpleComponentProps_DoesNotDie, etc) { - auto propParser = RawPropsParser(); - propParser.prepare(); - auto const &sourceProps = SimpleComponentProps(); - auto const &rawProps = RawProps(folly::dynamic::object(\\"xx_invalid_xx\\", \\"xx_invalid_xx\\")); - - ContextContainer contextContainer{}; - PropsParserContext parserContext{-1, contextContainer}; - - rawProps.parse(propParser, parserContext); - SimpleComponentProps(parserContext, sourceProps, rawProps); -}", -} -`; - -exports[`GenerateTests can generate fixture COMPONENT_WITH_INT_ENUM_STATE 1`] = ` -Map { - "Tests.cpp" => "/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateTests.js - * */ - -#include -#include -#include -#include -#include -#include - -using namespace facebook::react; - -TEST(SimpleComponentProps_DoesNotDie, etc) { - auto propParser = RawPropsParser(); - propParser.prepare(); - auto const &sourceProps = SimpleComponentProps(); - auto const &rawProps = RawProps(folly::dynamic::object(\\"xx_invalid_xx\\", \\"xx_invalid_xx\\")); - - ContextContainer contextContainer{}; - PropsParserContext parserContext{-1, contextContainer}; - - rawProps.parse(propParser, parserContext); - SimpleComponentProps(parserContext, sourceProps, rawProps); -}", -} -`; - -exports[`GenerateTests can generate fixture COMPONENT_WITH_INT_STATE 1`] = ` -Map { - "Tests.cpp" => "/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateTests.js - * */ - -#include -#include -#include -#include -#include -#include - -using namespace facebook::react; - -TEST(SimpleComponentProps_DoesNotDie, etc) { - auto propParser = RawPropsParser(); - propParser.prepare(); - auto const &sourceProps = SimpleComponentProps(); - auto const &rawProps = RawProps(folly::dynamic::object(\\"xx_invalid_xx\\", \\"xx_invalid_xx\\")); - - ContextContainer contextContainer{}; - PropsParserContext parserContext{-1, contextContainer}; - - rawProps.parse(propParser, parserContext); - SimpleComponentProps(parserContext, sourceProps, rawProps); -}", -} -`; - -exports[`GenerateTests can generate fixture COMPONENT_WITH_OBJECT_STATE 1`] = ` -Map { - "Tests.cpp" => "/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateTests.js - * */ - -#include -#include -#include -#include -#include -#include - -using namespace facebook::react; - -TEST(SimpleComponentProps_DoesNotDie, etc) { - auto propParser = RawPropsParser(); - propParser.prepare(); - auto const &sourceProps = SimpleComponentProps(); - auto const &rawProps = RawProps(folly::dynamic::object(\\"xx_invalid_xx\\", \\"xx_invalid_xx\\")); - - ContextContainer contextContainer{}; - PropsParserContext parserContext{-1, contextContainer}; - - rawProps.parse(propParser, parserContext); - SimpleComponentProps(parserContext, sourceProps, rawProps); -}", -} -`; - -exports[`GenerateTests can generate fixture COMPONENT_WITH_POINT_STATE 1`] = ` -Map { - "Tests.cpp" => "/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateTests.js - * */ - -#include -#include -#include -#include -#include -#include - -using namespace facebook::react; - -TEST(SimpleComponentProps_DoesNotDie, etc) { - auto propParser = RawPropsParser(); - propParser.prepare(); - auto const &sourceProps = SimpleComponentProps(); - auto const &rawProps = RawProps(folly::dynamic::object(\\"xx_invalid_xx\\", \\"xx_invalid_xx\\")); - - ContextContainer contextContainer{}; - PropsParserContext parserContext{-1, contextContainer}; - - rawProps.parse(propParser, parserContext); - SimpleComponentProps(parserContext, sourceProps, rawProps); -}", -} -`; - -exports[`GenerateTests can generate fixture COMPONENT_WITH_STRING_ENUM_STATE_PROPS 1`] = ` -Map { - "Tests.cpp" => "/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateTests.js - * */ - -#include -#include -#include -#include -#include -#include - -using namespace facebook::react; - -TEST(SimpleComponentProps_DoesNotDie, etc) { - auto propParser = RawPropsParser(); - propParser.prepare(); - auto const &sourceProps = SimpleComponentProps(); - auto const &rawProps = RawProps(folly::dynamic::object(\\"xx_invalid_xx\\", \\"xx_invalid_xx\\")); - - ContextContainer contextContainer{}; - PropsParserContext parserContext{-1, contextContainer}; - - rawProps.parse(propParser, parserContext); - SimpleComponentProps(parserContext, sourceProps, rawProps); -}", -} -`; - -exports[`GenerateTests can generate fixture COMPONENT_WITH_STRING_STATE 1`] = ` -Map { - "Tests.cpp" => "/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateTests.js - * */ - -#include -#include -#include -#include -#include -#include - -using namespace facebook::react; - -TEST(SimpleComponentProps_DoesNotDie, etc) { - auto propParser = RawPropsParser(); - propParser.prepare(); - auto const &sourceProps = SimpleComponentProps(); - auto const &rawProps = RawProps(folly::dynamic::object(\\"xx_invalid_xx\\", \\"xx_invalid_xx\\")); - - ContextContainer contextContainer{}; - PropsParserContext parserContext{-1, contextContainer}; - - rawProps.parse(propParser, parserContext); - SimpleComponentProps(parserContext, sourceProps, rawProps); -}", -} -`; - -exports[`GenerateTests can generate fixture COMPONENTS_WITH_IMAGES_IN_STATE 1`] = ` -Map { - "Tests.cpp" => "/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateTests.js - * */ - -#include -#include -#include -#include -#include -#include -#include - -using namespace facebook::react; - -TEST(SimpleComponentProps_DoesNotDie, etc) { - auto propParser = RawPropsParser(); - propParser.prepare(); - auto const &sourceProps = SimpleComponentProps(); - auto const &rawProps = RawProps(folly::dynamic::object(\\"xx_invalid_xx\\", \\"xx_invalid_xx\\")); - - ContextContainer contextContainer{}; - PropsParserContext parserContext{-1, contextContainer}; - - rawProps.parse(propParser, parserContext); - SimpleComponentProps(parserContext, sourceProps, rawProps); -} - -TEST(SimpleComponentProps_imageSource, etc) { - auto propParser = RawPropsParser(); - propParser.prepare(); - auto const &sourceProps = SimpleComponentProps(); - auto const &rawProps = RawProps(folly::dynamic::object(\\"imageSource\\", folly::dynamic::object(\\"url\\", \\"testurl\\"))); - - ContextContainer contextContainer{}; - PropsParserContext parserContext{-1, contextContainer}; - - rawProps.parse(propParser, parserContext); - SimpleComponentProps(parserContext, sourceProps, rawProps); -}", -} -`; - exports[`GenerateTests can generate fixture DOUBLE_PROPS 1`] = ` Map { "Tests.cpp" => "/** diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateThirdPartyFabricComponentsProviderH-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateThirdPartyFabricComponentsProviderH-test.js.snap index 902b991cc046d4..4cab36433d2411 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateThirdPartyFabricComponentsProviderH-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateThirdPartyFabricComponentsProviderH-test.js.snap @@ -52,21 +52,6 @@ Class CommandNativeComponentCls(void) __attribute__((u Class ExcludedAndroidComponentCls(void) __attribute__((used)); // EXCLUDE_ANDROID Class MultiFileIncludedNativeComponentCls(void) __attribute__((used)); // EXCLUDE_IOS_TWO_COMPONENTS_DIFFERENT_FILES -Class SimpleComponentCls(void) __attribute__((used)); // COMPONENT_WITH_BOOL_STATE -Class SimpleComponentCls(void) __attribute__((used)); // COMPONENT_WITH_STRING_STATE -Class SimpleComponentCls(void) __attribute__((used)); // COMPONENT_WITH_INT_STATE -Class SimpleComponentCls(void) __attribute__((used)); // COMPONENT_WITH_FLOAT_STATE -Class SimpleComponentCls(void) __attribute__((used)); // COMPONENT_WITH_DOUBLE_STATE -Class SimpleComponentCls(void) __attribute__((used)); // COMPONENT_WITH_COLOR_STATE -Class SimpleComponentCls(void) __attribute__((used)); // COMPONENT_WITH_POINT_STATE -Class SimpleComponentCls(void) __attribute__((used)); // COMPONENT_WITH_IMAGE_STATE -Class SimpleComponentCls(void) __attribute__((used)); // COMPONENT_WITH_EDGE_INSET_STATE_PROPS -Class SimpleComponentCls(void) __attribute__((used)); // COMPONENT_WITH_ARRAY_STATE -Class SimpleComponentCls(void) __attribute__((used)); // COMPONENT_WITH_OBJECT_STATE -Class SimpleComponentCls(void) __attribute__((used)); // COMPONENT_WITH_ARRAY_OF_OBJECTS_STATE -Class SimpleComponentCls(void) __attribute__((used)); // COMPONENT_WITH_STRING_ENUM_STATE_PROPS -Class SimpleComponentCls(void) __attribute__((used)); // COMPONENT_WITH_INT_ENUM_STATE -Class SimpleComponentCls(void) __attribute__((used)); // COMPONENTS_WITH_IMAGES_IN_STATE #ifdef __cplusplus } diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateThirdPartyFabricComponentsProviderObjCpp-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateThirdPartyFabricComponentsProviderObjCpp-test.js.snap index 06af76d00eb588..0fa2add3459f5b 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateThirdPartyFabricComponentsProviderObjCpp-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateThirdPartyFabricComponentsProviderObjCpp-test.js.snap @@ -76,36 +76,6 @@ Class RCTThirdPartyFabricComponentsProvider(const char {\\"MultiFileIncludedNativeComponent\\", MultiFileIncludedNativeComponentCls}, // EXCLUDE_IOS_TWO_COMPONENTS_DIFFERENT_FILES - - {\\"SimpleComponent\\", SimpleComponentCls}, // COMPONENT_WITH_BOOL_STATE - - {\\"SimpleComponent\\", SimpleComponentCls}, // COMPONENT_WITH_STRING_STATE - - {\\"SimpleComponent\\", SimpleComponentCls}, // COMPONENT_WITH_INT_STATE - - {\\"SimpleComponent\\", SimpleComponentCls}, // COMPONENT_WITH_FLOAT_STATE - - {\\"SimpleComponent\\", SimpleComponentCls}, // COMPONENT_WITH_DOUBLE_STATE - - {\\"SimpleComponent\\", SimpleComponentCls}, // COMPONENT_WITH_COLOR_STATE - - {\\"SimpleComponent\\", SimpleComponentCls}, // COMPONENT_WITH_POINT_STATE - - {\\"SimpleComponent\\", SimpleComponentCls}, // COMPONENT_WITH_IMAGE_STATE - - {\\"SimpleComponent\\", SimpleComponentCls}, // COMPONENT_WITH_EDGE_INSET_STATE_PROPS - - {\\"SimpleComponent\\", SimpleComponentCls}, // COMPONENT_WITH_ARRAY_STATE - - {\\"SimpleComponent\\", SimpleComponentCls}, // COMPONENT_WITH_OBJECT_STATE - - {\\"SimpleComponent\\", SimpleComponentCls}, // COMPONENT_WITH_ARRAY_OF_OBJECTS_STATE - - {\\"SimpleComponent\\", SimpleComponentCls}, // COMPONENT_WITH_STRING_ENUM_STATE_PROPS - - {\\"SimpleComponent\\", SimpleComponentCls}, // COMPONENT_WITH_INT_ENUM_STATE - - {\\"SimpleComponent\\", SimpleComponentCls}, // COMPONENTS_WITH_IMAGES_IN_STATE }; auto p = sFabricComponentsClassMap.find(name); diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateViewConfigJs-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateViewConfigJs-test.js.snap index cef9e05a8d3082..a48a2426a815e3 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateViewConfigJs-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateViewConfigJs-test.js.snap @@ -239,476 +239,6 @@ export const Commands = { } `; -exports[`GenerateViewConfigJs can generate fixture COMPONENT_WITH_ARRAY_OF_OBJECTS_STATE 1`] = ` -Map { - "COMPONENT_WITH_ARRAY_OF_OBJECTS_STATENativeViewConfig.js" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @flow - * - * @generated by codegen project: GenerateViewConfigJs.js - */ - -'use strict'; - -const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); - -let nativeComponentName = 'SimpleComponent'; - - -export const __INTERNAL_VIEW_CONFIG = { - uiViewClassName: 'SimpleComponent', - validAttributes: {}, -}; - -export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); -", -} -`; - -exports[`GenerateViewConfigJs can generate fixture COMPONENT_WITH_ARRAY_STATE 1`] = ` -Map { - "COMPONENT_WITH_ARRAY_STATENativeViewConfig.js" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @flow - * - * @generated by codegen project: GenerateViewConfigJs.js - */ - -'use strict'; - -const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); - -let nativeComponentName = 'SimpleComponent'; - - -export const __INTERNAL_VIEW_CONFIG = { - uiViewClassName: 'SimpleComponent', - validAttributes: {}, -}; - -export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); -", -} -`; - -exports[`GenerateViewConfigJs can generate fixture COMPONENT_WITH_BOOL_STATE 1`] = ` -Map { - "COMPONENT_WITH_BOOL_STATENativeViewConfig.js" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @flow - * - * @generated by codegen project: GenerateViewConfigJs.js - */ - -'use strict'; - -const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); - -let nativeComponentName = 'SimpleComponent'; - - -export const __INTERNAL_VIEW_CONFIG = { - uiViewClassName: 'SimpleComponent', - validAttributes: {}, -}; - -export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); -", -} -`; - -exports[`GenerateViewConfigJs can generate fixture COMPONENT_WITH_COLOR_STATE 1`] = ` -Map { - "COMPONENT_WITH_COLOR_STATENativeViewConfig.js" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @flow - * - * @generated by codegen project: GenerateViewConfigJs.js - */ - -'use strict'; - -const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); - -let nativeComponentName = 'SimpleComponent'; - - -export const __INTERNAL_VIEW_CONFIG = { - uiViewClassName: 'SimpleComponent', - validAttributes: {}, -}; - -export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); -", -} -`; - -exports[`GenerateViewConfigJs can generate fixture COMPONENT_WITH_DOUBLE_STATE 1`] = ` -Map { - "COMPONENT_WITH_DOUBLE_STATENativeViewConfig.js" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @flow - * - * @generated by codegen project: GenerateViewConfigJs.js - */ - -'use strict'; - -const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); - -let nativeComponentName = 'SimpleComponent'; - - -export const __INTERNAL_VIEW_CONFIG = { - uiViewClassName: 'SimpleComponent', - validAttributes: {}, -}; - -export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); -", -} -`; - -exports[`GenerateViewConfigJs can generate fixture COMPONENT_WITH_EDGE_INSET_STATE_PROPS 1`] = ` -Map { - "COMPONENT_WITH_EDGE_INSET_STATE_PROPSNativeViewConfig.js" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @flow - * - * @generated by codegen project: GenerateViewConfigJs.js - */ - -'use strict'; - -const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); - -let nativeComponentName = 'SimpleComponent'; - - -export const __INTERNAL_VIEW_CONFIG = { - uiViewClassName: 'SimpleComponent', - validAttributes: {}, -}; - -export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); -", -} -`; - -exports[`GenerateViewConfigJs can generate fixture COMPONENT_WITH_FLOAT_STATE 1`] = ` -Map { - "COMPONENT_WITH_FLOAT_STATENativeViewConfig.js" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @flow - * - * @generated by codegen project: GenerateViewConfigJs.js - */ - -'use strict'; - -const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); - -let nativeComponentName = 'SimpleComponent'; - - -export const __INTERNAL_VIEW_CONFIG = { - uiViewClassName: 'SimpleComponent', - validAttributes: {}, -}; - -export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); -", -} -`; - -exports[`GenerateViewConfigJs can generate fixture COMPONENT_WITH_IMAGE_STATE 1`] = ` -Map { - "COMPONENT_WITH_IMAGE_STATENativeViewConfig.js" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @flow - * - * @generated by codegen project: GenerateViewConfigJs.js - */ - -'use strict'; - -const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); - -let nativeComponentName = 'SimpleComponent'; - - -export const __INTERNAL_VIEW_CONFIG = { - uiViewClassName: 'SimpleComponent', - validAttributes: {}, -}; - -export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); -", -} -`; - -exports[`GenerateViewConfigJs can generate fixture COMPONENT_WITH_INT_ENUM_STATE 1`] = ` -Map { - "COMPONENT_WITH_INT_ENUM_STATENativeViewConfig.js" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @flow - * - * @generated by codegen project: GenerateViewConfigJs.js - */ - -'use strict'; - -const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); - -let nativeComponentName = 'SimpleComponent'; - - -export const __INTERNAL_VIEW_CONFIG = { - uiViewClassName: 'SimpleComponent', - validAttributes: {}, -}; - -export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); -", -} -`; - -exports[`GenerateViewConfigJs can generate fixture COMPONENT_WITH_INT_STATE 1`] = ` -Map { - "COMPONENT_WITH_INT_STATENativeViewConfig.js" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @flow - * - * @generated by codegen project: GenerateViewConfigJs.js - */ - -'use strict'; - -const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); - -let nativeComponentName = 'SimpleComponent'; - - -export const __INTERNAL_VIEW_CONFIG = { - uiViewClassName: 'SimpleComponent', - validAttributes: {}, -}; - -export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); -", -} -`; - -exports[`GenerateViewConfigJs can generate fixture COMPONENT_WITH_OBJECT_STATE 1`] = ` -Map { - "COMPONENT_WITH_OBJECT_STATENativeViewConfig.js" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @flow - * - * @generated by codegen project: GenerateViewConfigJs.js - */ - -'use strict'; - -const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); - -let nativeComponentName = 'SimpleComponent'; - - -export const __INTERNAL_VIEW_CONFIG = { - uiViewClassName: 'SimpleComponent', - validAttributes: {}, -}; - -export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); -", -} -`; - -exports[`GenerateViewConfigJs can generate fixture COMPONENT_WITH_POINT_STATE 1`] = ` -Map { - "COMPONENT_WITH_POINT_STATENativeViewConfig.js" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @flow - * - * @generated by codegen project: GenerateViewConfigJs.js - */ - -'use strict'; - -const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); - -let nativeComponentName = 'SimpleComponent'; - - -export const __INTERNAL_VIEW_CONFIG = { - uiViewClassName: 'SimpleComponent', - validAttributes: {}, -}; - -export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); -", -} -`; - -exports[`GenerateViewConfigJs can generate fixture COMPONENT_WITH_STRING_ENUM_STATE_PROPS 1`] = ` -Map { - "COMPONENT_WITH_STRING_ENUM_STATE_PROPSNativeViewConfig.js" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @flow - * - * @generated by codegen project: GenerateViewConfigJs.js - */ - -'use strict'; - -const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); - -let nativeComponentName = 'SimpleComponent'; - - -export const __INTERNAL_VIEW_CONFIG = { - uiViewClassName: 'SimpleComponent', - validAttributes: {}, -}; - -export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); -", -} -`; - -exports[`GenerateViewConfigJs can generate fixture COMPONENT_WITH_STRING_STATE 1`] = ` -Map { - "COMPONENT_WITH_STRING_STATENativeViewConfig.js" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @flow - * - * @generated by codegen project: GenerateViewConfigJs.js - */ - -'use strict'; - -const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); - -let nativeComponentName = 'SimpleComponent'; - - -export const __INTERNAL_VIEW_CONFIG = { - uiViewClassName: 'SimpleComponent', - validAttributes: {}, -}; - -export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); -", -} -`; - -exports[`GenerateViewConfigJs can generate fixture COMPONENTS_WITH_IMAGES_IN_STATE 1`] = ` -Map { - "COMPONENTS_WITH_IMAGES_IN_STATENativeViewConfig.js" => " -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @flow - * - * @generated by codegen project: GenerateViewConfigJs.js - */ - -'use strict'; - -const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); - -let nativeComponentName = 'SimpleComponent'; - - -export const __INTERNAL_VIEW_CONFIG = { - uiViewClassName: 'SimpleComponent', - - validAttributes: { - imageSource: { - process: require('react-native/Libraries/Image/resolveAssetSource'), - }, - }, -}; - -export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); -", -} -`; - exports[`GenerateViewConfigJs can generate fixture DOUBLE_PROPS 1`] = ` Map { "DOUBLE_PROPSNativeViewConfig.js" => " diff --git a/packages/react-native-codegen/src/parsers/consistency/__tests__/checkComponentSnaps-test.js b/packages/react-native-codegen/src/parsers/consistency/__tests__/checkComponentSnaps-test.js index cf2f51b1780bc0..c1088b1f0b0c67 100644 --- a/packages/react-native-codegen/src/parsers/consistency/__tests__/checkComponentSnaps-test.js +++ b/packages/react-native-codegen/src/parsers/consistency/__tests__/checkComponentSnaps-test.js @@ -19,10 +19,9 @@ const tsFixtures = require('../../typescript/components/__test_fixtures__/fixtur const tsSnaps = require('../../../../src/parsers/typescript/components/__tests__/__snapshots__/typescript-component-parser-test.js.snap'); const tsExtraCases = [ 'ARRAY2_PROP_TYPES_NO_EVENTS', - 'ARRAY2_STATE_TYPES', 'PROPS_AND_EVENTS_WITH_INTERFACES', ]; -const ignoredCases = ['ARRAY_PROP_TYPES_NO_EVENTS', 'ARRAY_STATE_TYPES']; +const ignoredCases = ['ARRAY_PROP_TYPES_NO_EVENTS']; compareSnaps( flowFixtures, 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 20d5b6044b6165..1d7072636a48a8 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 @@ -579,402 +579,6 @@ export default (codegenNativeComponent( ): HostComponent); `; -// === STATE === -const NULLABLE_STATE_WITH_DEFAULT = ` -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict-local - */ - -'use strict'; - -const codegenNativeComponent = require('codegenNativeComponent'); - -import type {WithDefault, Float} from 'CodegenTypes'; -import type {ViewProps} from 'ViewPropTypes'; -import type {HostComponent} from 'react-native'; - -export type ModuleProps = $ReadOnly<{| - ...ViewProps, - -|}>; - -export type ModuleNativeState = $ReadOnly<{| - nullable_with_default: ?WithDefault, -|}>; - -export default (codegenNativeComponent( - 'Module', -): HostComponent); -`; - -const NON_OPTIONAL_KEY_STATE_WITH_DEFAULT_VALUE = ` -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict-local - */ - -'use strict'; - -const codegenNativeComponent = require('codegenNativeComponent'); - -import type {WithDefault, Float} from 'CodegenTypes'; -import type {ViewProps} from 'ViewPropTypes'; -import type {HostComponent} from 'react-native'; - -export type ModuleProps = $ReadOnly<{| - ...ViewProps, - required_key_with_default: WithDefault, -|}>; - -export type ModuleNativeState = $ReadOnly<{| - required_key_with_default: WithDefault, -|}>; - -export default (codegenNativeComponent( - 'Module', -): HostComponent); -`; - -const STATE_CONFLICT_NAMES = ` -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict-local - */ - -'use strict'; - -import type {ViewProps} from 'ViewPropTypes'; -import type {HostComponent} from 'react-native'; - -const codegenNativeComponent = require('codegenNativeComponent'); - -export type ModuleProps = $ReadOnly<{| - ...ViewProps, - isEnabled: string, - - isEnabled: boolean, -|}>; - -export type ModuleNativeState = $ReadOnly<{| - isEnabled: string, - - isEnabled: boolean, -|}>; - -export default (codegenNativeComponent( - 'Module', -): HostComponent); -`; - -const STATE_CONFLICT_WITH_SPREAD_PROPS = ` -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict-local - */ - -'use strict'; - -import type {ViewProps} from 'ViewPropTypes'; -import type {HostComponent} from 'react-native'; - -const codegenNativeComponent = require('codegenNativeComponent'); - -type StateInFile = $ReadOnly<{| - isEnabled: boolean, -|}>; - -export type ModuleProps = $ReadOnly<{| - ...ViewProps, -|}>; - -export type ModuleNativeState = $ReadOnly<{| - ...StateInFile, - isEnabled: boolean, -|}>; - -export default (codegenNativeComponent( - 'Module', -): HostComponent); -`; - -const STATE_SPREAD_CONFLICTS_WITH_PROPS = ` -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict-local - */ - -'use strict'; - -import type {ViewProps} from 'ViewPropTypes'; -import type {HostComponent} from 'react-native'; - -const codegenNativeComponent = require('codegenNativeComponent'); - -type StateInFile = $ReadOnly<{| - isEnabled: boolean, -|}>; - -export type ModuleProps = $ReadOnly<{| - ...ViewProps, -|}>; - -export type ModuleNativeState = $ReadOnly<{| - isEnabled: boolean, - ...StateInFile, -|}>; - -export default (codegenNativeComponent( - 'Module', -): HostComponent); -`; - -const STATE_NUMBER_TYPE = ` -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict-local - */ - -'use strict'; - -import type {ViewProps} from 'ViewPropTypes'; -import type {HostComponent} from 'react-native'; - -const codegenNativeComponent = require('codegenNativeComponent'); - -export type ModuleProps = $ReadOnly<{| - ...ViewProps, -|}>; - -export type ModuleNativeState = $ReadOnly<{| - someProp: number -|}>; - -export default (codegenNativeComponent( - 'Module', -): HostComponent); -`; - -const STATE_MIXED_ENUM = ` -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict-local - */ - -'use strict'; - -import type {ViewProps} from 'ViewPropTypes'; -import type {HostComponent} from 'react-native'; - -const codegenNativeComponent = require('codegenNativeComponent'); - -export type ModuleProps = $ReadOnly<{| - ...ViewProps, -|}>; - -export type ModuleNativeState = $ReadOnly<{| - someProp?: WithDefault<'foo' | 1, 1> -|}>; - -export default (codegenNativeComponent( - 'Module', -): HostComponent); -`; - -const STATE_ENUM_BOOLEAN = ` -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict-local - */ - -'use strict'; - -import type {ViewProps} from 'ViewPropTypes'; -import type {HostComponent} from 'react-native'; - -const codegenNativeComponent = require('codegenNativeComponent'); - -export type ModuleProps = $ReadOnly<{| - ...ViewProps, -|}>; - -export type ModuleNativeState = $ReadOnly<{| - someProp?: WithDefault -|}>; - -export default (codegenNativeComponent( - 'Module', -): HostComponent); -`; - -const STATE_ARRAY_MIXED_ENUM = ` -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict-local - */ - -'use strict'; - -import type {ViewProps} from 'ViewPropTypes'; -import type {HostComponent} from 'react-native'; - -const codegenNativeComponent = require('codegenNativeComponent'); - -export type ModuleProps = $ReadOnly<{| - ...ViewProps, -|}>; - -export type ModuleNativeState = $ReadOnly<{| - someProp?: WithDefault<$ReadOnlyArray<'foo' | 1>, 1> -|}>; - -export default (codegenNativeComponent( - 'Module', -): HostComponent); -`; - -const STATE_ARRAY_ENUM_BOOLEAN = ` -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict-local - */ - -'use strict'; - -import type {ViewProps} from 'ViewPropTypes'; -import type {HostComponent} from 'react-native'; - -const codegenNativeComponent = require('codegenNativeComponent'); - -export type ModuleProps = $ReadOnly<{| - ...ViewProps, -|}>; - -export type ModuleNativeState = $ReadOnly<{| - someProp?: WithDefault<$ReadOnlyArray, false> -|}>; - -export default (codegenNativeComponent( - 'Module', -): HostComponent); -`; - -const STATE_ARRAY_ENUM_INT = ` -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict-local - */ - -'use strict'; - -import type {ViewProps} from 'ViewPropTypes'; -import type {HostComponent} from 'react-native'; - -const codegenNativeComponent = require('codegenNativeComponent'); - -export type ModuleProps = $ReadOnly<{| - ...ViewProps, -|}>; - -export type ModuleNativeState = $ReadOnly<{| - someProp?: WithDefault<$ReadOnlyArray<0 | 1>, 0> -|}>; - -export default (codegenNativeComponent( - 'Module', -): HostComponent); -`; - -const DOUBLE_STATE_IN_FILE = ` -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict-local - */ - -'use strict'; - -import type {ViewProps} from 'ViewPropTypes'; -import type {HostComponent} from 'react-native'; - -const codegenNativeComponent = require('codegenNativeComponent'); - -export type ModuleProps = $ReadOnly<{| - ...ViewProps, -|}>; - -type SecondNativeState = $ReadOnly<{| - someProp: boolean -|}>; - -export type FirstNativeState = $ReadOnly<{| - someOtherProp: boolean -|}>; - -export default (codegenNativeComponent( - 'Module', -): HostComponent); -`; - module.exports = { COMMANDS_DEFINED_INLINE, COMMANDS_DEFINED_MULTIPLE_TIMES, @@ -993,16 +597,4 @@ module.exports = { PROP_ARRAY_MIXED_ENUM, PROP_ARRAY_ENUM_BOOLEAN, PROP_ARRAY_ENUM_INT, - NULLABLE_STATE_WITH_DEFAULT, - NON_OPTIONAL_KEY_STATE_WITH_DEFAULT_VALUE, - STATE_CONFLICT_NAMES, - STATE_CONFLICT_WITH_SPREAD_PROPS, - STATE_SPREAD_CONFLICTS_WITH_PROPS, - STATE_NUMBER_TYPE, - STATE_MIXED_ENUM, - STATE_ENUM_BOOLEAN, - STATE_ARRAY_MIXED_ENUM, - STATE_ARRAY_ENUM_BOOLEAN, - STATE_ARRAY_ENUM_INT, - DOUBLE_STATE_IN_FILE, }; 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 548399cd1cfb2b..c597a2d1f5dfc9 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 @@ -939,7 +939,7 @@ export default (codegenNativeComponent( ): NativeType); `; -const COMMANDS_EVENTS_STATE_TYPES_EXPORTED = ` +const COMMANDS_EVENTS_TYPES_EXPORTED = ` /** * Copyright (c) Meta Platforms, Inc. and affiliates. * @@ -981,13 +981,6 @@ export type ModuleProps = $ReadOnly<{| onDirectEventDefinedInlineWithPaperName: DirectEventHandler, |}>; -// Add state here -export type ModuleNativeState = $ReadOnly<{| - boolean_required: boolean, - boolean_optional_key?: WithDefault, - boolean_optional_both?: WithDefault, -|}> - type NativeType = HostComponent; export type ScrollTo = (viewRef: React.ElementRef, y: Int, animated: Boolean) => Void; @@ -1005,501 +998,6 @@ export default (codegenNativeComponent( ): NativeType); `; -// === STATE === // -const ALL_STATE_TYPES = ` -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict-local - */ - -'use strict'; - -const codegenNativeComponent = require('codegenNativeComponent'); - -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 {HostComponent} from 'react-native'; - -type ModuleProps = $ReadOnly<{| - ...ViewProps, -|}>; - -type ModuleNativeState = $ReadOnly<{| - // Boolean props - boolean_required: boolean, - boolean_optional_key?: WithDefault, - boolean_optional_both?: WithDefault, - - // Boolean props, null default - boolean_null_optional_key?: WithDefault, - boolean_null_optional_both?: WithDefault, - - // String props - string_required: string, - string_optional_key?: WithDefault, - string_optional_both?: WithDefault, - - // String props, null default - string_null_optional_key?: WithDefault, - string_null_optional_both?: WithDefault, - - // Stringish props - stringish_required: Stringish, - stringish_optional_key?: WithDefault, - stringish_optional_both?: WithDefault, - - // Stringish props, null default - stringish_null_optional_key?: WithDefault, - stringish_null_optional_both?: WithDefault, - - // Double props - double_required: Double, - double_optional_key?: WithDefault, - double_optional_both?: WithDefault, - - // Float props - float_required: Float, - float_optional_key?: WithDefault, - float_optional_both?: WithDefault, - - // Float props, null default - float_null_optional_key?: WithDefault, - float_null_optional_both?: WithDefault, - - // Float props, negative default - negative_float_optional_key?: WithDefault; - negative_float_optional_both?: WithDefault; - - // Int32 props - int32_required: Int32, - int32_optional_key?: WithDefault, - int32_optional_both?: WithDefault, - - // String enum props - enum_optional_key?: WithDefault<'small' | 'large', 'small'>, - enum_optional_both?: WithDefault<'small' | 'large', 'small'>, - - // Int enum props - int_enum_optional_key?: WithDefault<0 | 1, 0>, - - // Object props - object_optional_key?: $ReadOnly<{| prop: string |}>, - object_optional_both?: ?$ReadOnly<{| prop: string |}>, - object_optional_value: ?$ReadOnly<{| prop: string |}>, - - // ImageSource props - image_required: ImageSource, - image_optional_value: ?ImageSource, - image_optional_both?: ?ImageSource, - - // ColorValue props - color_required: ColorValue, - color_optional_key?: ColorValue, - color_optional_value: ?ColorValue, - color_optional_both?: ?ColorValue, - - // ColorArrayValue props - color_array_required: ColorArrayValue, - color_array_optional_key?: ColorArrayValue, - color_array_optional_value: ?ColorArrayValue, - color_array_optional_both?: ?ColorArrayValue, - - // ProcessedColorValue props - processed_color_required: ProcessedColorValue, - processed_color_optional_key?: ProcessedColorValue, - processed_color_optional_value: ?ProcessedColorValue, - processed_color_optional_both?: ?ProcessedColorValue, - - // PointValue props - point_required: PointValue, - point_optional_key?: PointValue, - point_optional_value: ?PointValue, - point_optional_both?: ?PointValue, - - // EdgeInsets props - insets_required: EdgeInsetsValue, - insets_optional_key?: EdgeInsetsValue, - insets_optional_value: ?EdgeInsetsValue, - insets_optional_both?: ?EdgeInsetsValue, -|}>; - -export default (codegenNativeComponent( - 'Module', -): HostComponent); -`; - -const STATE_NEGATIVE_DEFAULTS = ` -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const codegenNativeComponent = require('codegenNativeComponent'); - -import type {Int32, Double, Float, WithDefault} from 'CodegenTypes'; -import type {ImageSource} from 'ImageSource'; -import type {ColorValue, PointValue, ProcessColorValue, EdgeInsetsValue} from 'StyleSheetTypes'; -import type {ViewProps} from 'ViewPropTypes'; -import type {HostComponent} from 'react-native'; - -type ModuleProps = $ReadOnly<{| - ...ViewProps, -|}>; - -type ModuleNativeState = $ReadOnly<{| - - // Negative numbers default - negative_float_optional_key?: WithDefault; - negative_int_optional_key?: WithDefault; - negative_double_optional_key?: WithDefault; -|}> - -export default codegenNativeComponent( - 'Module', -) as HostComponent; -`; - -const ARRAY_STATE_TYPES = ` -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict-local - */ - -'use strict'; - -const codegenNativeComponent = require('codegenNativeComponent'); - -import type {Int32, Double, Float, WithDefault} from 'CodegenTypes'; -import type {ImageSource} from 'ImageSource'; -import type {ColorValue, PointValue, ProcessColorValue, EdgeInsetsValue} from 'StyleSheetTypes'; -import type {ViewProps} from 'ViewPropTypes'; -import type {HostComponent} from 'react-native'; - -type ObjectType = $ReadOnly<{| prop: string |}>; -type ArrayObjectType = $ReadOnlyArray<$ReadOnly<{| prop: string |}>>; - -type ModuleProps = $ReadOnly<{| - ...ViewProps, -|}>; - -type ModuleNativeState = $ReadOnly<{| - // Props - // Boolean props - array_boolean_required: $ReadOnlyArray, - array_boolean_optional_key?: $ReadOnlyArray, - array_boolean_optional_value: ?$ReadOnlyArray, - array_boolean_optional_both?: ?$ReadOnlyArray, - - // String props - array_string_required: $ReadOnlyArray, - array_string_optional_key?: $ReadOnlyArray, - array_string_optional_value: ?$ReadOnlyArray, - array_string_optional_both?: ?$ReadOnlyArray, - - // Double props - array_double_required: $ReadOnlyArray, - array_double_optional_key?: $ReadOnlyArray, - array_double_optional_value: ?$ReadOnlyArray, - array_double_optional_both?: ?$ReadOnlyArray, - - // Float props - array_float_required: $ReadOnlyArray, - array_float_optional_key?: $ReadOnlyArray, - array_float_optional_value: ?$ReadOnlyArray, - array_float_optional_both?: ?$ReadOnlyArray, - - // Int32 props - array_int32_required: $ReadOnlyArray, - array_int32_optional_key?: $ReadOnlyArray, - array_int32_optional_value: ?$ReadOnlyArray, - array_int32_optional_both?: ?$ReadOnlyArray, - - // String enum props - array_enum_optional_key?: WithDefault< - $ReadOnlyArray<'small' | 'large'>, - 'small', - >, - array_enum_optional_both?: WithDefault< - $ReadOnlyArray<'small' | 'large'>, - 'small', - >, - - // ImageSource props - array_image_required: $ReadOnlyArray, - array_image_optional_key?: $ReadOnlyArray, - array_image_optional_value: ?$ReadOnlyArray, - array_image_optional_both?: ?$ReadOnlyArray, - - // ColorValue props - array_color_required: $ReadOnlyArray, - array_color_optional_key?: $ReadOnlyArray, - array_color_optional_value: ?$ReadOnlyArray, - array_color_optional_both?: ?$ReadOnlyArray, - - // PointValue props - array_point_required: $ReadOnlyArray, - array_point_optional_key?: $ReadOnlyArray, - array_point_optional_value: ?$ReadOnlyArray, - array_point_optional_both?: ?$ReadOnlyArray, - - // EdgeInsetsValue props - array_insets_required: $ReadOnlyArray, - array_insets_optional_key?: $ReadOnlyArray, - array_insets_optional_value: ?$ReadOnlyArray, - array_insets_optional_both?: ?$ReadOnlyArray, - - // Object props - array_object_required: $ReadOnlyArray<$ReadOnly<{| prop: string |}>>, - array_object_optional_key?: $ReadOnlyArray<$ReadOnly<{| prop: string |}>>, - array_object_optional_value: ?ArrayObjectType, - array_object_optional_both?: ?$ReadOnlyArray, - - // Nested array object types - array_of_array_object_required: $ReadOnlyArray< - $ReadOnly<{| - // This needs to be the same name as the top level array above - array_object_required: $ReadOnlyArray<$ReadOnly<{| prop: string |}>>, - |}> - >, - array_of_array_object_optional_key?: $ReadOnlyArray< - $ReadOnly<{| - // This needs to be the same name as the top level array above - array_object_optional_key: $ReadOnlyArray<$ReadOnly<{| prop?: string |}>>, - |}> - >, - array_of_array_object_optional_value: ?$ReadOnlyArray< - $ReadOnly<{| - // This needs to be the same name as the top level array above - array_object_optional_value: $ReadOnlyArray<$ReadOnly<{| prop: ?string |}>>, - |}> - >, - array_of_array_object_optional_both?: ?$ReadOnlyArray< - $ReadOnly<{| - // This needs to be the same name as the top level array above - array_object_optional_both: $ReadOnlyArray<$ReadOnly<{| prop?: ?string |}>>, - |}> - >, - - // Nested array of array of object types - array_of_array_of_object_required: $ReadOnlyArray< - $ReadOnlyArray< - $ReadOnly<{| - prop: string, - |}>, - >, - >, - - // Nested array of array of object types (in file) - array_of_array_of_object_required_in_file: $ReadOnlyArray< - $ReadOnlyArray, - >, - - // Nested array of array of object types (with spread) - array_of_array_of_object_required_with_spread: $ReadOnlyArray< - $ReadOnlyArray< - $ReadOnly<{| - ...ObjectType - |}>, - >, - >, -|}>; - -export default (codegenNativeComponent( - 'Module', -): HostComponent); -`; - -const OBJECT_STATE_TYPES = ` -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict-local - */ - -'use strict'; - -const codegenNativeComponent = require('codegenNativeComponent'); - -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 {HostComponent} from 'react-native'; - -type ModuleProps = $ReadOnly<{| - ...ViewProps, -|}>; - -type ModuleNativeState = $ReadOnly<{| - // Props - // Boolean props - boolean_required: $ReadOnly<{|prop: boolean|}>, - boolean_optional: $ReadOnly<{|prop?: WithDefault|}>, - - // String props - string_required: $ReadOnly<{|prop: string|}>, - string_optional: $ReadOnly<{|prop?: WithDefault|}>, - - // Double props - double_required: $ReadOnly<{|prop: Double|}>, - double_optional: $ReadOnly<{|prop?: WithDefault|}>, - - // Float props - float_required: $ReadOnly<{|prop: Float|}>, - float_optional: $ReadOnly<{|prop?: WithDefault|}>, - - // Int32 props - int_required: $ReadOnly<{|prop: Int32|}>, - int_optional: $ReadOnly<{|prop?: WithDefault|}>, - - // String enum props - enum_optional: $ReadOnly<{| - prop?: WithDefault<$ReadOnlyArray<'small' | 'large'>, 'small'>, - |}>, - - // ImageSource props - image_required: $ReadOnly<{|prop: ImageSource|}>, - image_optional_key: $ReadOnly<{|prop?: ImageSource|}>, - image_optional_value: $ReadOnly<{|prop: ?ImageSource|}>, - image_optional_both: $ReadOnly<{|prop?: ?ImageSource|}>, - - // ColorValue props - color_required: $ReadOnly<{|prop: ColorValue|}>, - color_optional_key: $ReadOnly<{|prop?: ColorValue|}>, - color_optional_value: $ReadOnly<{|prop: ?ColorValue|}>, - color_optional_both: $ReadOnly<{|prop?: ?ColorValue|}>, - - // ProcessedColorValue props - processed_color_required: $ReadOnly<{|prop: ProcessedColorValue|}>, - processed_color_optional_key: $ReadOnly<{|prop?: ProcessedColorValue|}>, - processed_color_optional_value: $ReadOnly<{|prop: ?ProcessedColorValue|}>, - processed_color_optional_both: $ReadOnly<{|prop?: ?ProcessedColorValue|}>, - - // PointValue props - point_required: $ReadOnly<{|prop: PointValue|}>, - point_optional_key: $ReadOnly<{|prop?: PointValue|}>, - point_optional_value: $ReadOnly<{|prop: ?PointValue|}>, - point_optional_both: $ReadOnly<{|prop?: ?PointValue|}>, - - // EdgeInsetsValue props - insets_required: $ReadOnly<{|prop: EdgeInsetsValue|}>, - insets_optional_key: $ReadOnly<{|prop?: EdgeInsetsValue|}>, - insets_optional_value: $ReadOnly<{|prop: ?EdgeInsetsValue|}>, - insets_optional_both: $ReadOnly<{|prop?: ?EdgeInsetsValue|}>, - - // Nested object props - object_required: $ReadOnly<{|prop: $ReadOnly<{nestedProp: string}>|}>, - object_optional_key?: $ReadOnly<{|prop: $ReadOnly<{nestedProp: string}>|}>, - object_optional_value: ?$ReadOnly<{|prop: $ReadOnly<{nestedProp: string}>|}>, - object_optional_both?: ?$ReadOnly<{|prop: $ReadOnly<{nestedProp: string}>|}>, -|}>; - -export default (codegenNativeComponent( - 'Module', -): HostComponent); -`; - -const STATE_WITH_IMAGES = ` -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict-local - */ - -'use strict'; - -const codegenNativeComponent = require('codegenNativeComponent'); -import type {ImageSource} from 'ImageSource'; - -type ModuleProps = $ReadOnly<{| - ...ViewProps, - imageSource: ImageSource, -|}>; - -type ModuleNativeState = $ReadOnly<{| - imageSource: ImageSource, - imageRequest: ImageRequest, -|}>; - -export default (codegenNativeComponent( - 'Module', -): HostComponent); -`; - -//TODO: fix this. The code is the same as per the props, but it fails with the State. -// const STATE_ALIASED_LOCALLY = ` -// /** -// * Copyright (c) Meta Platforms, Inc. and affiliates. -// * -// * This source code is licensed under the MIT license found in the -// * LICENSE file in the root directory of this source tree. -// * -// * @format -// * @flow strict-local -// */ - -// 'use strict'; - -// import type {ViewProps} from 'ViewPropTypes'; -// import type {HostComponent} from 'react-native'; - -// const codegenNativeComponent = require('codegenNativeComponent'); - -// type DeepSpread = $ReadOnly<{| -// otherStringProp: string, -// |}>; - -// export type StateInFile = $ReadOnly<{| -// ...DeepSpread, -// isEnabled: boolean, -// label: string, -// |}>; - -// export type ModuleProps = $ReadOnly<{| -// ...ViewProps, -// |}>; - -// export type ModuleNativeState = $ReadOnly<{| -// ...StateInFile, - -// localType: $ReadOnly<{| -// ...StateInFile -// |}>, - -// localArr: $ReadOnlyArray -// ||}>; - -// export default (codegenNativeComponent( -// 'Module', -// ): HostComponent); -// `; - module.exports = { ALL_PROP_TYPES_NO_EVENTS, ARRAY_PROP_TYPES_NO_EVENTS, @@ -1511,14 +1009,8 @@ module.exports = { EVENTS_DEFINED_INLINE_WITH_ALL_TYPES, EVENTS_DEFINED_AS_NULL_INLINE, PROPS_AND_EVENTS_TYPES_EXPORTED, - COMMANDS_EVENTS_STATE_TYPES_EXPORTED, + COMMANDS_EVENTS_TYPES_EXPORTED, COMMANDS_DEFINED_WITH_ALL_TYPES, PROPS_AS_EXTERNAL_TYPES, COMMANDS_WITH_EXTERNAL_TYPES, - ALL_STATE_TYPES, - ARRAY_STATE_TYPES, - OBJECT_STATE_TYPES, - STATE_NEGATIVE_DEFAULTS, - STATE_WITH_IMAGES, - // STATE_ALIASED_LOCALLY, }; diff --git a/packages/react-native-codegen/src/parsers/flow/components/__tests__/__snapshots__/component-parser-test.js.snap b/packages/react-native-codegen/src/parsers/flow/components/__tests__/__snapshots__/component-parser-test.js.snap index 0df5be6f35b5cd..abfa4a1f7e36a2 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/__tests__/__snapshots__/component-parser-test.js.snap +++ b/packages/react-native-codegen/src/parsers/flow/components/__tests__/__snapshots__/component-parser-test.js.snap @@ -12,14 +12,8 @@ exports[`RN Codegen Flow Parser Fails with error message COMMANDS_DEFINED_WITHOU exports[`RN Codegen Flow Parser Fails with error message COMMANDS_DEFINED_WITHOUT_REF 1`] = `"The first argument of method hotspotUpdate must be of type React.ElementRef<>"`; -exports[`RN Codegen Flow Parser Fails with error message DOUBLE_STATE_IN_FILE 1`] = `"Found 2 NativeStates for Module. Each component can have only 1 NativeState"`; - -exports[`RN Codegen Flow Parser Fails with error message NON_OPTIONAL_KEY_STATE_WITH_DEFAULT_VALUE 1`] = `"key required_key_with_default must be optional if used with WithDefault<> annotation"`; - exports[`RN Codegen Flow Parser Fails with error message NON_OPTIONAL_KEY_WITH_DEFAULT_VALUE 1`] = `"key required_key_with_default must be optional if used with WithDefault<> annotation"`; -exports[`RN Codegen Flow Parser Fails with error message NULLABLE_STATE_WITH_DEFAULT 1`] = `"WithDefault<> is optional and does not need to be marked as optional. Please remove the ? annotation in front of it."`; - exports[`RN Codegen Flow Parser Fails with error message NULLABLE_WITH_DEFAULT 1`] = `"WithDefault<> is optional and does not need to be marked as optional. Please remove the ? annotation in front of it."`; exports[`RN Codegen Flow Parser Fails with error message PROP_ARRAY_ENUM_BOOLEAN 1`] = `"Unsupported union type for \\"someProp\\", received \\"BooleanLiteralTypeAnnotation\\""`; @@ -40,24 +34,6 @@ exports[`RN Codegen Flow Parser Fails with error message PROPS_CONFLICT_WITH_SPR exports[`RN Codegen Flow Parser Fails with error message PROPS_SPREAD_CONFLICTS_WITH_PROPS 1`] = `"A prop was already defined with the name isEnabled"`; -exports[`RN Codegen Flow Parser Fails with error message STATE_ARRAY_ENUM_BOOLEAN 1`] = `"Unsupported union type for \\"someProp\\", received \\"BooleanLiteralTypeAnnotation\\""`; - -exports[`RN Codegen Flow Parser Fails with error message STATE_ARRAY_ENUM_INT 1`] = `"Arrays of int enums are not supported (see: \\"someProp\\")"`; - -exports[`RN Codegen Flow Parser Fails with error message STATE_ARRAY_MIXED_ENUM 1`] = `"Mixed types are not supported (see \\"someProp\\")"`; - -exports[`RN Codegen Flow Parser Fails with error message STATE_CONFLICT_NAMES 1`] = `"A prop was already defined with the name isEnabled"`; - -exports[`RN Codegen Flow Parser Fails with error message STATE_CONFLICT_WITH_SPREAD_PROPS 1`] = `"A prop was already defined with the name isEnabled"`; - -exports[`RN Codegen Flow Parser Fails with error message STATE_ENUM_BOOLEAN 1`] = `"Unsupported union type for \\"someProp\\", received \\"BooleanLiteralTypeAnnotation\\""`; - -exports[`RN Codegen Flow Parser Fails with error message STATE_MIXED_ENUM 1`] = `"Mixed types are not supported (see \\"someProp\\")."`; - -exports[`RN Codegen Flow Parser Fails with error message STATE_NUMBER_TYPE 1`] = `"Cannot use \\"NumberTypeAnnotation\\" type annotation for \\"someProp\\": must use a specific numeric type like Int32, Double, or Float"`; - -exports[`RN Codegen Flow Parser Fails with error message STATE_SPREAD_CONFLICTS_WITH_PROPS 1`] = `"A prop was already defined with the name isEnabled"`; - exports[`RN Codegen Flow Parser can generate fixture ALL_PROP_TYPES_NO_EVENTS 1`] = ` "{ 'modules': { @@ -573,7 +549,7 @@ exports[`RN Codegen Flow Parser can generate fixture ALL_PROP_TYPES_NO_EVENTS 1` }" `; -exports[`RN Codegen Flow Parser can generate fixture ALL_STATE_TYPES 1`] = ` +exports[`RN Codegen Flow Parser can generate fixture ARRAY_PROP_TYPES_NO_EVENTS 1`] = ` "{ 'modules': { 'Module': { @@ -587,517 +563,692 @@ exports[`RN Codegen Flow Parser can generate fixture ALL_STATE_TYPES 1`] = ` } ], 'events': [], - 'props': [], - 'commands': [], - 'state': [ + 'props': [ { - 'name': 'boolean_required', + 'name': 'array_boolean_required', 'optional': false, 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation', - 'default': false - } - }, - { - 'name': 'boolean_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation', - 'default': true + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'BooleanTypeAnnotation' + } } }, { - 'name': 'boolean_optional_both', + 'name': 'array_boolean_optional_key', 'optional': true, 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation', - 'default': true + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'BooleanTypeAnnotation' + } } }, { - 'name': 'boolean_null_optional_key', + 'name': 'array_boolean_optional_value', 'optional': true, 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation', - 'default': null + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'BooleanTypeAnnotation' + } } }, { - 'name': 'boolean_null_optional_both', + 'name': 'array_boolean_optional_both', 'optional': true, 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation', - 'default': null + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'BooleanTypeAnnotation' + } } }, { - 'name': 'string_required', + 'name': 'array_string_required', 'optional': false, 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - }, - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': '' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'StringTypeAnnotation' + } } }, { - 'name': 'string_optional_both', + 'name': 'array_string_optional_key', 'optional': true, 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': '' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'StringTypeAnnotation' + } } }, { - 'name': 'string_null_optional_key', + 'name': 'array_string_optional_value', 'optional': true, 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'StringTypeAnnotation' + } } }, { - 'name': 'string_null_optional_both', + 'name': 'array_string_optional_both', 'optional': true, 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'StringTypeAnnotation' + } } }, { - 'name': 'stringish_required', + 'name': 'array_double_required', 'optional': false, 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - }, - { - 'name': 'stringish_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': '' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'DoubleTypeAnnotation' + } } }, { - 'name': 'stringish_optional_both', + 'name': 'array_double_optional_key', 'optional': true, 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': '' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'DoubleTypeAnnotation' + } } }, { - 'name': 'stringish_null_optional_key', + 'name': 'array_double_optional_value', 'optional': true, 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'DoubleTypeAnnotation' + } } }, { - 'name': 'stringish_null_optional_both', + 'name': 'array_double_optional_both', 'optional': true, 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'DoubleTypeAnnotation' + } } }, { - 'name': 'double_required', + 'name': 'array_float_required', 'optional': false, 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation', - 'default': 0 + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'FloatTypeAnnotation' + } } }, { - 'name': 'double_optional_key', + 'name': 'array_float_optional_key', 'optional': true, 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation', - 'default': 1.1 + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'FloatTypeAnnotation' + } } }, { - 'name': 'double_optional_both', + 'name': 'array_float_optional_value', 'optional': true, 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation', - 'default': 1.1 + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'FloatTypeAnnotation' + } } }, { - 'name': 'float_required', - 'optional': false, + 'name': 'array_float_optional_both', + 'optional': true, 'typeAnnotation': { - 'type': 'FloatTypeAnnotation', - 'default': 0 + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'FloatTypeAnnotation' + } } }, { - 'name': 'float_optional_key', - 'optional': true, + 'name': 'array_int32_required', + 'optional': false, 'typeAnnotation': { - 'type': 'FloatTypeAnnotation', - 'default': 1.1 + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'Int32TypeAnnotation' + } } }, { - 'name': 'float_optional_both', + 'name': 'array_int32_optional_key', 'optional': true, 'typeAnnotation': { - 'type': 'FloatTypeAnnotation', - 'default': 1.1 + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'Int32TypeAnnotation' + } } }, { - 'name': 'float_null_optional_key', + 'name': 'array_int32_optional_value', 'optional': true, 'typeAnnotation': { - 'type': 'FloatTypeAnnotation', - 'default': null + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'Int32TypeAnnotation' + } } }, { - 'name': 'float_null_optional_both', + 'name': 'array_int32_optional_both', 'optional': true, 'typeAnnotation': { - 'type': 'FloatTypeAnnotation', - 'default': null + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'Int32TypeAnnotation' + } } }, { - 'name': 'negative_float_optional_key', + 'name': 'array_enum_optional_key', 'optional': true, 'typeAnnotation': { - 'type': 'FloatTypeAnnotation', - 'default': -1 + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'StringEnumTypeAnnotation', + 'default': 'small', + 'options': [ + 'small', + 'large' + ] + } } }, { - 'name': 'negative_float_optional_both', + 'name': 'array_enum_optional_both', 'optional': true, 'typeAnnotation': { - 'type': 'FloatTypeAnnotation', - 'default': -1 + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'StringEnumTypeAnnotation', + 'default': 'small', + 'options': [ + 'small', + 'large' + ] + } } }, { - 'name': 'int32_required', + 'name': 'array_image_required', 'optional': false, 'typeAnnotation': { - 'type': 'Int32TypeAnnotation', - 'default': 0 + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ImageSourcePrimitive' + } } }, { - 'name': 'int32_optional_key', + 'name': 'array_image_optional_key', 'optional': true, 'typeAnnotation': { - 'type': 'Int32TypeAnnotation', - 'default': 1 + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ImageSourcePrimitive' + } } }, { - 'name': 'int32_optional_both', + 'name': 'array_image_optional_value', 'optional': true, 'typeAnnotation': { - 'type': 'Int32TypeAnnotation', - 'default': 1 + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ImageSourcePrimitive' + } } }, { - 'name': 'enum_optional_key', + 'name': 'array_image_optional_both', 'optional': true, 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'default': 'small', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'enum_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'default': 'small', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'int_enum_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32EnumTypeAnnotation', - 'default': 0, - 'options': [ - 0, - 1 - ] - } - }, - { - 'name': 'object_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ImageSourcePrimitive' + } } }, { - 'name': 'object_optional_both', - 'optional': true, + 'name': 'array_color_required', + 'optional': false, 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ColorPrimitive' + } } }, { - 'name': 'object_optional_value', + 'name': 'array_color_optional_key', 'optional': true, 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } - }, - { - 'name': 'image_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ColorPrimitive' + } } }, { - 'name': 'image_optional_value', + 'name': 'array_color_optional_value', 'optional': true, 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ColorPrimitive' + } } }, { - 'name': 'image_optional_both', + 'name': 'array_color_optional_both', 'optional': true, 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ColorPrimitive' + } } }, { - 'name': 'color_required', + 'name': 'array_point_required', 'optional': false, 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'PointPrimitive' + } } }, { - 'name': 'color_optional_key', + 'name': 'array_point_optional_key', 'optional': true, 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'PointPrimitive' + } } }, { - 'name': 'color_optional_value', + 'name': 'array_point_optional_value', 'optional': true, 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'PointPrimitive' + } } }, { - 'name': 'color_optional_both', + 'name': 'array_point_optional_both', 'optional': true, 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'PointPrimitive' + } } }, { - 'name': 'color_array_required', + 'name': 'array_insets_required', 'optional': false, 'typeAnnotation': { 'type': 'ArrayTypeAnnotation', 'elementType': { 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' + 'name': 'EdgeInsetsPrimitive' } } }, { - 'name': 'color_array_optional_key', + 'name': 'array_insets_optional_key', 'optional': true, 'typeAnnotation': { 'type': 'ArrayTypeAnnotation', 'elementType': { 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' + 'name': 'EdgeInsetsPrimitive' } } }, { - 'name': 'color_array_optional_value', + 'name': 'array_insets_optional_value', 'optional': true, 'typeAnnotation': { 'type': 'ArrayTypeAnnotation', 'elementType': { 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' + 'name': 'EdgeInsetsPrimitive' } } }, { - 'name': 'color_array_optional_both', + 'name': 'array_insets_optional_both', 'optional': true, 'typeAnnotation': { 'type': 'ArrayTypeAnnotation', 'elementType': { 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' + 'name': 'EdgeInsetsPrimitive' } } }, { - 'name': 'processed_color_required', + 'name': 'array_object_required', 'optional': false, 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } } }, { - 'name': 'processed_color_optional_key', + 'name': 'array_object_optional_key', 'optional': true, 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } } }, { - 'name': 'processed_color_optional_value', + 'name': 'array_object_optional_value', 'optional': true, 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } } }, { - 'name': 'processed_color_optional_both', + 'name': 'array_object_optional_both', 'optional': true, 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } } }, { - 'name': 'point_required', + 'name': 'array_of_array_object_required', 'optional': false, 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' - } - }, - { - 'name': 'point_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' - } - }, - { - 'name': 'point_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'array_object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } + } + } + ] + } } }, { - 'name': 'point_optional_both', + 'name': 'array_of_array_object_optional_key', 'optional': true, 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'array_object_optional_key', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } + } + } + ] + } } }, { - 'name': 'insets_required', - 'optional': false, + 'name': 'array_of_array_object_optional_value', + 'optional': true, 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'array_object_optional_value', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } + } + } + ] + } } }, { - 'name': 'insets_optional_key', + 'name': 'array_of_array_object_optional_both', 'optional': true, 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'array_object_optional_both', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } + } + } + ] + } } }, { - 'name': 'insets_optional_value', - 'optional': true, + 'name': 'array_of_array_of_object_required', + 'optional': false, 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } + } } }, { - 'name': 'insets_optional_both', - 'optional': true, + 'name': 'array_of_array_of_object_required_in_file', + 'optional': false, 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } + } + } + }, + { + 'name': 'array_of_array_of_object_required_with_spread', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } + } } } - ] + ], + 'commands': [] } } } @@ -1105,7 +1256,7 @@ exports[`RN Codegen Flow Parser can generate fixture ALL_STATE_TYPES 1`] = ` }" `; -exports[`RN Codegen Flow Parser can generate fixture ARRAY_PROP_TYPES_NO_EVENTS 1`] = ` +exports[`RN Codegen Flow Parser can generate fixture COMMANDS_DEFINED_WITH_ALL_TYPES 1`] = ` "{ 'modules': { 'Module': { @@ -1119,1671 +1270,635 @@ exports[`RN Codegen Flow Parser can generate fixture ARRAY_PROP_TYPES_NO_EVENTS } ], 'events': [], - 'props': [ + 'props': [], + 'commands': [ { - 'name': 'array_boolean_required', + 'name': 'handleRootTag', 'optional': false, 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'BooleanTypeAnnotation' - } - } - }, - { - 'name': 'array_boolean_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'BooleanTypeAnnotation' + 'type': 'FunctionTypeAnnotation', + 'params': [ + { + 'name': 'rootTag', + 'typeAnnotation': { + 'type': 'ReservedTypeAnnotation', + 'name': 'RootTag' + } + } + ], + 'returnTypeAnnotation': { + 'type': 'VoidTypeAnnotation' } } }, { - 'name': 'array_boolean_optional_value', - 'optional': true, + 'name': 'hotspotUpdate', + 'optional': false, 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'BooleanTypeAnnotation' + 'type': 'FunctionTypeAnnotation', + 'params': [ + { + 'name': 'x', + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'y', + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ], + 'returnTypeAnnotation': { + 'type': 'VoidTypeAnnotation' } } }, { - 'name': 'array_boolean_optional_both', - 'optional': true, + 'name': 'scrollTo', + 'optional': false, 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'BooleanTypeAnnotation' - } - } - }, - { - 'name': 'array_string_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'StringTypeAnnotation' - } - } - }, - { - 'name': 'array_string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'StringTypeAnnotation' - } - } - }, - { - 'name': 'array_string_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'StringTypeAnnotation' - } - } - }, - { - 'name': 'array_string_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'StringTypeAnnotation' - } - } - }, - { - 'name': 'array_double_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'DoubleTypeAnnotation' - } - } - }, - { - 'name': 'array_double_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'DoubleTypeAnnotation' - } - } - }, - { - 'name': 'array_double_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'DoubleTypeAnnotation' - } - } - }, - { - 'name': 'array_double_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'DoubleTypeAnnotation' - } - } - }, - { - 'name': 'array_float_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'FloatTypeAnnotation' - } - } - }, - { - 'name': 'array_float_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'FloatTypeAnnotation' - } - } - }, - { - 'name': 'array_float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'FloatTypeAnnotation' - } - } - }, - { - 'name': 'array_float_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'FloatTypeAnnotation' - } - } - }, - { - 'name': 'array_int32_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'Int32TypeAnnotation' - } - } - }, - { - 'name': 'array_int32_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'Int32TypeAnnotation' - } - } - }, - { - 'name': 'array_int32_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'Int32TypeAnnotation' - } - } - }, - { - 'name': 'array_int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'Int32TypeAnnotation' - } - } - }, - { - 'name': 'array_enum_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'StringEnumTypeAnnotation', - 'default': 'small', - 'options': [ - 'small', - 'large' - ] + 'type': 'FunctionTypeAnnotation', + 'params': [ + { + 'name': 'x', + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'y', + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'z', + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'animated', + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ], + 'returnTypeAnnotation': { + 'type': 'VoidTypeAnnotation' } } - }, + } + ] + } + } + } + } +}" +`; + +exports[`RN Codegen Flow Parser can generate fixture COMMANDS_EVENTS_TYPES_EXPORTED 1`] = ` +"{ + 'modules': { + 'Module': { + 'type': 'Component', + 'components': { + 'Module': { + 'extendsProps': [ { - 'name': 'array_enum_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'StringEnumTypeAnnotation', - 'default': 'small', - 'options': [ - 'small', - 'large' - ] - } - } - }, + 'type': 'ReactNativeBuiltInType', + 'knownTypeName': 'ReactNativeCoreViewProps' + } + ], + 'events': [ { - 'name': 'array_image_required', + 'name': 'onBubblingEventDefinedInline', 'optional': false, + 'bubblingType': 'bubble', 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' - } - } - }, - { - 'name': 'array_image_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' - } - } - }, - { - 'name': 'array_image_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' - } - } - }, - { - 'name': 'array_image_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' - } - } - }, - { - 'name': 'array_color_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - }, - { - 'name': 'array_color_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - }, - { - 'name': 'array_color_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - }, - { - 'name': 'array_color_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - }, - { - 'name': 'array_point_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' - } - } - }, - { - 'name': 'array_point_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' - } - } - }, - { - 'name': 'array_point_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' - } - } - }, - { - 'name': 'array_point_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' - } - } - }, - { - 'name': 'array_insets_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' - } - } - }, - { - 'name': 'array_insets_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' - } - } - }, - { - 'name': 'array_insets_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' - } - } - }, - { - 'name': 'array_insets_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' - } - } - }, - { - 'name': 'array_object_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { + 'type': 'EventTypeAnnotation', + 'argument': { 'type': 'ObjectTypeAnnotation', 'properties': [ { - 'name': 'prop', + 'name': 'boolean_required', 'optional': false, 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null + 'type': 'BooleanTypeAnnotation' } - } - ] - } - } - }, - { - 'name': 'array_object_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ + }, { - 'name': 'prop', - 'optional': false, + 'name': 'boolean_optional_key', + 'optional': true, 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null + 'type': 'BooleanTypeAnnotation' } - } - ] - } - } - }, - { - 'name': 'array_object_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ + }, { - 'name': 'prop', - 'optional': false, + 'name': 'boolean_optional_value', + 'optional': true, 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null + 'type': 'BooleanTypeAnnotation' } - } - ] - } - } - }, - { - 'name': 'array_object_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ + }, { - 'name': 'prop', - 'optional': false, + 'name': 'boolean_optional_both', + 'optional': true, 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null + 'type': 'BooleanTypeAnnotation' } - } - ] - } - } - }, - { - 'name': 'array_of_array_object_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ + }, { - 'name': 'array_object_required', + 'name': 'string_required', 'optional': false, 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } + 'type': 'StringTypeAnnotation' } - } - ] - } - } - }, - { - 'name': 'array_of_array_object_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ + }, { - 'name': 'array_object_optional_key', + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_required', 'optional': false, 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } + 'type': 'DoubleTypeAnnotation' } - } - ] - } - } - }, - { - 'name': 'array_of_array_object_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ + }, { - 'name': 'array_object_optional_value', + 'name': 'double_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_required', 'optional': false, 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } + 'type': 'FloatTypeAnnotation' } - } - ] - } - } - }, - { - 'name': 'array_of_array_object_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ + }, { - 'name': 'array_object_optional_both', + 'name': 'float_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_required', 'optional': false, 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } + 'type': 'Int32TypeAnnotation' } - } - ] - } - } - }, - { - 'name': 'array_of_array_of_object_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } + }, + { + 'name': 'int32_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' } - ] - } - } - } - }, - { - 'name': 'array_of_array_of_object_required_in_file', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } + }, + { + 'name': 'int32_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' } - ] - } - } - } - }, - { - 'name': 'array_of_array_of_object_required_with_spread', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' } - ] - } - } - } - } - ], - 'commands': [] - } - } - } - } -}" -`; - -exports[`RN Codegen Flow Parser can generate fixture ARRAY_STATE_TYPES 1`] = ` -"{ - 'modules': { - 'Module': { - 'type': 'Component', - 'components': { - 'Module': { - 'extendsProps': [ - { - 'type': 'ReactNativeBuiltInType', - 'knownTypeName': 'ReactNativeCoreViewProps' - } - ], - 'events': [], - 'props': [], - 'commands': [], - 'state': [ - { - 'name': 'array_boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'BooleanTypeAnnotation' + }, + { + 'name': 'enum_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_required_nested_2_layers', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'object_optional_nested_1_layer', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + }, + { + 'name': 'object_readonly_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] } } }, { - 'name': 'array_boolean_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'BooleanTypeAnnotation' - } - } - }, - { - 'name': 'array_boolean_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'BooleanTypeAnnotation' - } - } - }, - { - 'name': 'array_boolean_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'BooleanTypeAnnotation' - } - } - }, - { - 'name': 'array_string_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'StringTypeAnnotation' - } - } - }, - { - 'name': 'array_string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'StringTypeAnnotation' - } - } - }, - { - 'name': 'array_string_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'StringTypeAnnotation' - } - } - }, - { - 'name': 'array_string_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'StringTypeAnnotation' - } - } - }, - { - 'name': 'array_double_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'DoubleTypeAnnotation' - } - } - }, - { - 'name': 'array_double_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'DoubleTypeAnnotation' - } - } - }, - { - 'name': 'array_double_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'DoubleTypeAnnotation' - } - } - }, - { - 'name': 'array_double_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'DoubleTypeAnnotation' - } - } - }, - { - 'name': 'array_float_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'FloatTypeAnnotation' - } - } - }, - { - 'name': 'array_float_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'FloatTypeAnnotation' - } - } - }, - { - 'name': 'array_float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'FloatTypeAnnotation' - } - } - }, - { - 'name': 'array_float_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'FloatTypeAnnotation' - } - } - }, - { - 'name': 'array_int32_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'Int32TypeAnnotation' - } - } - }, - { - 'name': 'array_int32_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'Int32TypeAnnotation' - } - } - }, - { - 'name': 'array_int32_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'Int32TypeAnnotation' - } - } - }, - { - 'name': 'array_int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'Int32TypeAnnotation' - } - } - }, - { - 'name': 'array_enum_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'StringEnumTypeAnnotation', - 'default': 'small', - 'options': [ - 'small', - 'large' - ] - } - } - }, - { - 'name': 'array_enum_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'StringEnumTypeAnnotation', - 'default': 'small', - 'options': [ - 'small', - 'large' - ] - } - } - }, - { - 'name': 'array_image_required', + 'name': 'onBubblingEventDefinedInlineWithPaperName', 'optional': false, + 'bubblingType': 'bubble', + 'paperTopLevelNameDeprecated': 'paperBubblingEventDefinedInlineWithPaperName', 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' - } - } - }, - { - 'name': 'array_image_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' - } - } - }, - { - 'name': 'array_image_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' - } - } - }, - { - 'name': 'array_image_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' - } - } - }, - { - 'name': 'array_color_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - }, - { - 'name': 'array_color_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - }, - { - 'name': 'array_color_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - }, - { - 'name': 'array_color_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - }, - { - 'name': 'array_point_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' - } - } - }, - { - 'name': 'array_point_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' - } - } - }, - { - 'name': 'array_point_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' - } - } - }, - { - 'name': 'array_point_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' - } - } - }, - { - 'name': 'array_insets_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' - } - } - }, - { - 'name': 'array_insets_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' - } - } - }, - { - 'name': 'array_insets_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' - } - } - }, - { - 'name': 'array_insets_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' - } - } - }, - { - 'name': 'array_object_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { + 'type': 'EventTypeAnnotation', + 'argument': { 'type': 'ObjectTypeAnnotation', 'properties': [ { - 'name': 'prop', + 'name': 'boolean_required', 'optional': false, 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null + 'type': 'BooleanTypeAnnotation' } - } - ] - } - } - }, - { - 'name': 'array_object_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ + }, { - 'name': 'prop', - 'optional': false, + 'name': 'boolean_optional_key', + 'optional': true, 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null + 'type': 'BooleanTypeAnnotation' } - } - ] - } - } - }, - { - 'name': 'array_object_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ + }, { - 'name': 'prop', - 'optional': false, + 'name': 'boolean_optional_value', + 'optional': true, 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null + 'type': 'BooleanTypeAnnotation' } - } - ] - } - } - }, - { - 'name': 'array_object_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ + }, { - 'name': 'prop', - 'optional': false, + 'name': 'boolean_optional_both', + 'optional': true, 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null + 'type': 'BooleanTypeAnnotation' } - } - ] - } - } - }, - { - 'name': 'array_of_array_object_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ + }, { - 'name': 'array_object_required', + 'name': 'string_required', 'optional': false, 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } + 'type': 'StringTypeAnnotation' } - } - ] - } - } - }, - { - 'name': 'array_of_array_object_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ + }, { - 'name': 'array_object_optional_key', + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_required', 'optional': false, 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } + 'type': 'DoubleTypeAnnotation' } - } - ] - } - } - }, - { - 'name': 'array_of_array_object_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ + }, { - 'name': 'array_object_optional_value', + 'name': 'double_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_required', 'optional': false, 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } + 'type': 'FloatTypeAnnotation' } - } - ] - } - } - }, - { - 'name': 'array_of_array_object_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ + }, { - 'name': 'array_object_optional_both', + 'name': 'float_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_required', 'optional': false, 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } + 'type': 'Int32TypeAnnotation' } - } - ] - } - } - }, - { - 'name': 'array_of_array_of_object_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } + }, + { + 'name': 'int32_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' } - ] - } - } - } - }, - { - 'name': 'array_of_array_of_object_required_in_file', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } + }, + { + 'name': 'int32_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' } - ] - } - } - } - }, - { - 'name': 'array_of_array_of_object_required_with_spread', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } - } - } - } - ] - } - } - } - } -}" -`; - -exports[`RN Codegen Flow Parser can generate fixture COMMANDS_DEFINED_WITH_ALL_TYPES 1`] = ` -"{ - 'modules': { - 'Module': { - 'type': 'Component', - 'components': { - 'Module': { - 'extendsProps': [ - { - 'type': 'ReactNativeBuiltInType', - 'knownTypeName': 'ReactNativeCoreViewProps' - } - ], - 'events': [], - 'props': [], - 'commands': [ - { - 'name': 'handleRootTag', - 'optional': false, - 'typeAnnotation': { - 'type': 'FunctionTypeAnnotation', - 'params': [ - { - 'name': 'rootTag', - 'typeAnnotation': { - 'type': 'ReservedTypeAnnotation', - 'name': 'RootTag' - } - } - ], - 'returnTypeAnnotation': { - 'type': 'VoidTypeAnnotation' - } - } - }, - { - 'name': 'hotspotUpdate', - 'optional': false, - 'typeAnnotation': { - 'type': 'FunctionTypeAnnotation', - 'params': [ - { - 'name': 'x', - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'y', - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - } - ], - 'returnTypeAnnotation': { - 'type': 'VoidTypeAnnotation' - } - } - }, - { - 'name': 'scrollTo', - 'optional': false, - 'typeAnnotation': { - 'type': 'FunctionTypeAnnotation', - 'params': [ - { - 'name': 'x', - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'y', - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'z', - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'animated', - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - } - ], - 'returnTypeAnnotation': { - 'type': 'VoidTypeAnnotation' - } - } - } - ] - } - } - } - } -}" -`; - -exports[`RN Codegen Flow Parser can generate fixture COMMANDS_EVENTS_STATE_TYPES_EXPORTED 1`] = ` -"{ - 'modules': { - 'Module': { - 'type': 'Component', - 'components': { - 'Module': { - 'extendsProps': [ - { - 'type': 'ReactNativeBuiltInType', - 'knownTypeName': 'ReactNativeCoreViewProps' - } - ], - 'events': [ - { - 'name': 'onBubblingEventDefinedInline', - 'optional': false, - 'bubblingType': 'bubble', - 'typeAnnotation': { - 'type': 'EventTypeAnnotation', - 'argument': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'boolean_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'boolean_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'boolean_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'string_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'string_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'string_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'double_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'double_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'double_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'double_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'float_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'float_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'float_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'int32_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'int32_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'int32_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' } }, { @@ -3016,10 +2131,9 @@ exports[`RN Codegen Flow Parser can generate fixture COMMANDS_EVENTS_STATE_TYPES } }, { - 'name': 'onBubblingEventDefinedInlineWithPaperName', + 'name': 'onDirectEventDefinedInline', 'optional': false, - 'bubblingType': 'bubble', - 'paperTopLevelNameDeprecated': 'paperBubblingEventDefinedInlineWithPaperName', + 'bubblingType': 'direct', 'typeAnnotation': { 'type': 'EventTypeAnnotation', 'argument': { @@ -3395,9 +2509,10 @@ exports[`RN Codegen Flow Parser can generate fixture COMMANDS_EVENTS_STATE_TYPES } }, { - 'name': 'onDirectEventDefinedInline', + 'name': 'onDirectEventDefinedInlineWithPaperName', 'optional': false, 'bubblingType': 'direct', + 'paperTopLevelNameDeprecated': 'paperDirectEventDefinedInlineWithPaperName', 'typeAnnotation': { 'type': 'EventTypeAnnotation', 'argument': { @@ -3771,12 +2886,254 @@ exports[`RN Codegen Flow Parser can generate fixture COMMANDS_EVENTS_STATE_TYPES ] } } + } + ], + 'props': [], + 'commands': [ + { + 'name': 'scrollTo', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'params': [ + { + 'name': 'y', + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'animated', + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ], + 'returnTypeAnnotation': { + 'type': 'VoidTypeAnnotation' + } + } + } + ] + } + } + } + } +}" +`; + +exports[`RN Codegen Flow Parser can generate fixture COMMANDS_WITH_EXTERNAL_TYPES 1`] = ` +"{ + 'modules': { + 'Module': { + 'type': 'Component', + 'components': { + 'Module': { + 'extendsProps': [ + { + 'type': 'ReactNativeBuiltInType', + 'knownTypeName': 'ReactNativeCoreViewProps' + } + ], + 'events': [], + 'props': [], + 'commands': [ + { + 'name': 'scrollTo', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'params': [ + { + 'name': 'y', + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'animated', + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ], + 'returnTypeAnnotation': { + 'type': 'VoidTypeAnnotation' + } + } + } + ] + } + } + } + } +}" +`; + +exports[`RN Codegen Flow Parser can generate fixture EVENTS_DEFINED_AS_NULL_INLINE 1`] = ` +"{ + 'modules': { + 'Module': { + 'type': 'Component', + 'components': { + 'Module': { + 'extendsProps': [ + { + 'type': 'ReactNativeBuiltInType', + 'knownTypeName': 'ReactNativeCoreViewProps' + } + ], + 'events': [ + { + 'name': 'onDirectEventDefinedInlineNull', + 'optional': false, + 'bubblingType': 'direct', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [] + } + } }, { - 'name': 'onDirectEventDefinedInlineWithPaperName', + 'name': 'onDirectEventDefinedInlineNullOptionalKey', + 'optional': true, + 'bubblingType': 'direct', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [] + } + } + }, + { + 'name': 'onDirectEventDefinedInlineNullOptionalValue', + 'optional': true, + 'bubblingType': 'direct', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [] + } + } + }, + { + 'name': 'onDirectEventDefinedInlineNullOptionalBoth', + 'optional': true, + 'bubblingType': 'direct', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [] + } + } + }, + { + 'name': 'onDirectEventDefinedInlineNullWithPaperName', + 'optional': true, + 'bubblingType': 'direct', + 'paperTopLevelNameDeprecated': 'paperDirectEventDefinedInlineNullWithPaperName', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [] + } + } + }, + { + 'name': 'onBubblingEventDefinedInlineNull', + 'optional': false, + 'bubblingType': 'bubble', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [] + } + } + }, + { + 'name': 'onBubblingEventDefinedInlineNullOptionalKey', + 'optional': true, + 'bubblingType': 'bubble', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [] + } + } + }, + { + 'name': 'onBubblingEventDefinedInlineNullOptionalValue', + 'optional': true, + 'bubblingType': 'bubble', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [] + } + } + }, + { + 'name': 'onBubblingEventDefinedInlineNullOptionalBoth', + 'optional': true, + 'bubblingType': 'bubble', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [] + } + } + }, + { + 'name': 'onBubblingEventDefinedInlineNullWithPaperName', + 'optional': true, + 'bubblingType': 'bubble', + 'paperTopLevelNameDeprecated': 'paperBubblingEventDefinedInlineNullWithPaperName', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [] + } + } + } + ], + 'props': [], + 'commands': [] + } + } + } + } +}" +`; + +exports[`RN Codegen Flow Parser can generate fixture EVENTS_DEFINED_INLINE_WITH_ALL_TYPES 1`] = ` +"{ + 'modules': { + 'Module': { + 'type': 'Component', + 'components': { + 'Module': { + 'extendsProps': [ + { + 'type': 'ReactNativeBuiltInType', + 'knownTypeName': 'ReactNativeCoreViewProps' + } + ], + 'events': [ + { + 'name': 'onDirectEventDefinedInline', 'optional': false, 'bubblingType': 'direct', - 'paperTopLevelNameDeprecated': 'paperDirectEventDefinedInlineWithPaperName', 'typeAnnotation': { 'type': 'EventTypeAnnotation', 'argument': { @@ -4150,280 +3507,11 @@ exports[`RN Codegen Flow Parser can generate fixture COMMANDS_EVENTS_STATE_TYPES ] } } - } - ], - 'props': [], - 'commands': [ + }, { - 'name': 'scrollTo', - 'optional': false, - 'typeAnnotation': { - 'type': 'FunctionTypeAnnotation', - 'params': [ - { - 'name': 'y', - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'animated', - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - } - ], - 'returnTypeAnnotation': { - 'type': 'VoidTypeAnnotation' - } - } - } - ], - 'state': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation', - 'default': false - } - }, - { - 'name': 'boolean_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation', - 'default': true - } - }, - { - 'name': 'boolean_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation', - 'default': true - } - } - ] - } - } - } - } -}" -`; - -exports[`RN Codegen Flow Parser can generate fixture COMMANDS_WITH_EXTERNAL_TYPES 1`] = ` -"{ - 'modules': { - 'Module': { - 'type': 'Component', - 'components': { - 'Module': { - 'extendsProps': [ - { - 'type': 'ReactNativeBuiltInType', - 'knownTypeName': 'ReactNativeCoreViewProps' - } - ], - 'events': [], - 'props': [], - 'commands': [ - { - 'name': 'scrollTo', - 'optional': false, - 'typeAnnotation': { - 'type': 'FunctionTypeAnnotation', - 'params': [ - { - 'name': 'y', - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'animated', - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - } - ], - 'returnTypeAnnotation': { - 'type': 'VoidTypeAnnotation' - } - } - } - ] - } - } - } - } -}" -`; - -exports[`RN Codegen Flow Parser can generate fixture EVENTS_DEFINED_AS_NULL_INLINE 1`] = ` -"{ - 'modules': { - 'Module': { - 'type': 'Component', - 'components': { - 'Module': { - 'extendsProps': [ - { - 'type': 'ReactNativeBuiltInType', - 'knownTypeName': 'ReactNativeCoreViewProps' - } - ], - 'events': [ - { - 'name': 'onDirectEventDefinedInlineNull', - 'optional': false, - 'bubblingType': 'direct', - 'typeAnnotation': { - 'type': 'EventTypeAnnotation', - 'argument': { - 'type': 'ObjectTypeAnnotation', - 'properties': [] - } - } - }, - { - 'name': 'onDirectEventDefinedInlineNullOptionalKey', - 'optional': true, - 'bubblingType': 'direct', - 'typeAnnotation': { - 'type': 'EventTypeAnnotation', - 'argument': { - 'type': 'ObjectTypeAnnotation', - 'properties': [] - } - } - }, - { - 'name': 'onDirectEventDefinedInlineNullOptionalValue', - 'optional': true, - 'bubblingType': 'direct', - 'typeAnnotation': { - 'type': 'EventTypeAnnotation', - 'argument': { - 'type': 'ObjectTypeAnnotation', - 'properties': [] - } - } - }, - { - 'name': 'onDirectEventDefinedInlineNullOptionalBoth', - 'optional': true, - 'bubblingType': 'direct', - 'typeAnnotation': { - 'type': 'EventTypeAnnotation', - 'argument': { - 'type': 'ObjectTypeAnnotation', - 'properties': [] - } - } - }, - { - 'name': 'onDirectEventDefinedInlineNullWithPaperName', + 'name': 'onDirectEventDefinedInlineOptionalKey', 'optional': true, 'bubblingType': 'direct', - 'paperTopLevelNameDeprecated': 'paperDirectEventDefinedInlineNullWithPaperName', - 'typeAnnotation': { - 'type': 'EventTypeAnnotation', - 'argument': { - 'type': 'ObjectTypeAnnotation', - 'properties': [] - } - } - }, - { - 'name': 'onBubblingEventDefinedInlineNull', - 'optional': false, - 'bubblingType': 'bubble', - 'typeAnnotation': { - 'type': 'EventTypeAnnotation', - 'argument': { - 'type': 'ObjectTypeAnnotation', - 'properties': [] - } - } - }, - { - 'name': 'onBubblingEventDefinedInlineNullOptionalKey', - 'optional': true, - 'bubblingType': 'bubble', - 'typeAnnotation': { - 'type': 'EventTypeAnnotation', - 'argument': { - 'type': 'ObjectTypeAnnotation', - 'properties': [] - } - } - }, - { - 'name': 'onBubblingEventDefinedInlineNullOptionalValue', - 'optional': true, - 'bubblingType': 'bubble', - 'typeAnnotation': { - 'type': 'EventTypeAnnotation', - 'argument': { - 'type': 'ObjectTypeAnnotation', - 'properties': [] - } - } - }, - { - 'name': 'onBubblingEventDefinedInlineNullOptionalBoth', - 'optional': true, - 'bubblingType': 'bubble', - 'typeAnnotation': { - 'type': 'EventTypeAnnotation', - 'argument': { - 'type': 'ObjectTypeAnnotation', - 'properties': [] - } - } - }, - { - 'name': 'onBubblingEventDefinedInlineNullWithPaperName', - 'optional': true, - 'bubblingType': 'bubble', - 'paperTopLevelNameDeprecated': 'paperBubblingEventDefinedInlineNullWithPaperName', - 'typeAnnotation': { - 'type': 'EventTypeAnnotation', - 'argument': { - 'type': 'ObjectTypeAnnotation', - 'properties': [] - } - } - } - ], - 'props': [], - 'commands': [] - } - } - } - } -}" -`; - -exports[`RN Codegen Flow Parser can generate fixture EVENTS_DEFINED_INLINE_WITH_ALL_TYPES 1`] = ` -"{ - 'modules': { - 'Module': { - 'type': 'Component', - 'components': { - 'Module': { - 'extendsProps': [ - { - 'type': 'ReactNativeBuiltInType', - 'knownTypeName': 'ReactNativeCoreViewProps' - } - ], - 'events': [ - { - 'name': 'onDirectEventDefinedInline', - 'optional': false, - 'bubblingType': 'direct', 'typeAnnotation': { 'type': 'EventTypeAnnotation', 'argument': { @@ -4799,7 +3887,7 @@ exports[`RN Codegen Flow Parser can generate fixture EVENTS_DEFINED_INLINE_WITH_ } }, { - 'name': 'onDirectEventDefinedInlineOptionalKey', + 'name': 'onDirectEventDefinedInlineOptionalValue', 'optional': true, 'bubblingType': 'direct', 'typeAnnotation': { @@ -5177,7 +4265,7 @@ exports[`RN Codegen Flow Parser can generate fixture EVENTS_DEFINED_INLINE_WITH_ } }, { - 'name': 'onDirectEventDefinedInlineOptionalValue', + 'name': 'onDirectEventDefinedInlineOptionalBoth', 'optional': true, 'bubblingType': 'direct', 'typeAnnotation': { @@ -5555,9 +4643,10 @@ exports[`RN Codegen Flow Parser can generate fixture EVENTS_DEFINED_INLINE_WITH_ } }, { - 'name': 'onDirectEventDefinedInlineOptionalBoth', + 'name': 'onDirectEventDefinedInlineWithPaperName', 'optional': true, 'bubblingType': 'direct', + 'paperTopLevelNameDeprecated': 'paperDirectEventDefinedInlineWithPaperName', 'typeAnnotation': { 'type': 'EventTypeAnnotation', 'argument': { @@ -5933,10 +5022,9 @@ exports[`RN Codegen Flow Parser can generate fixture EVENTS_DEFINED_INLINE_WITH_ } }, { - 'name': 'onDirectEventDefinedInlineWithPaperName', - 'optional': true, - 'bubblingType': 'direct', - 'paperTopLevelNameDeprecated': 'paperDirectEventDefinedInlineWithPaperName', + 'name': 'onBubblingEventDefinedInline', + 'optional': false, + 'bubblingType': 'bubble', 'typeAnnotation': { 'type': 'EventTypeAnnotation', 'argument': { @@ -6312,8 +5400,8 @@ exports[`RN Codegen Flow Parser can generate fixture EVENTS_DEFINED_INLINE_WITH_ } }, { - 'name': 'onBubblingEventDefinedInline', - 'optional': false, + 'name': 'onBubblingEventDefinedInlineOptionalKey', + 'optional': true, 'bubblingType': 'bubble', 'typeAnnotation': { 'type': 'EventTypeAnnotation', @@ -6690,7 +5778,7 @@ exports[`RN Codegen Flow Parser can generate fixture EVENTS_DEFINED_INLINE_WITH_ } }, { - 'name': 'onBubblingEventDefinedInlineOptionalKey', + 'name': 'onBubblingEventDefinedInlineOptionalValue', 'optional': true, 'bubblingType': 'bubble', 'typeAnnotation': { @@ -7068,7 +6156,7 @@ exports[`RN Codegen Flow Parser can generate fixture EVENTS_DEFINED_INLINE_WITH_ } }, { - 'name': 'onBubblingEventDefinedInlineOptionalValue', + 'name': 'onBubblingEventDefinedInlineOptionalBoth', 'optional': true, 'bubblingType': 'bubble', 'typeAnnotation': { @@ -7446,9 +6534,10 @@ exports[`RN Codegen Flow Parser can generate fixture EVENTS_DEFINED_INLINE_WITH_ } }, { - 'name': 'onBubblingEventDefinedInlineOptionalBoth', + 'name': 'onBubblingEventDefinedInlineWithPaperName', 'optional': true, 'bubblingType': 'bubble', + 'paperTopLevelNameDeprecated': 'paperBubblingEventDefinedInlineWithPaperName', 'typeAnnotation': { 'type': 'EventTypeAnnotation', 'argument': { @@ -7752,1144 +6841,79 @@ exports[`RN Codegen Flow Parser can generate fixture EVENTS_DEFINED_INLINE_WITH_ ] } } - ] - } - }, - { - 'name': 'object_readonly_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_readonly_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_readonly_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_readonly_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - } - ] - } - } - ] - } - } - }, - { - 'name': 'onBubblingEventDefinedInlineWithPaperName', - 'optional': true, - 'bubblingType': 'bubble', - 'paperTopLevelNameDeprecated': 'paperBubblingEventDefinedInlineWithPaperName', - 'typeAnnotation': { - 'type': 'EventTypeAnnotation', - 'argument': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'boolean_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'boolean_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'boolean_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'string_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'string_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'string_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'double_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'double_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'double_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'double_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'float_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'float_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'float_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'int32_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'int32_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'int32_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'enum_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'enum_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'enum_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'enum_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'object_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_required_nested_2_layers', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'object_optional_nested_1_layer', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'double_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - } - ] - } - } - ] - } - }, - { - 'name': 'object_readonly_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_readonly_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_readonly_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_readonly_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - } - ] - } - } - ] - } - } - } - ], - 'props': [], - 'commands': [] - } - } - } - } -}" -`; - -exports[`RN Codegen Flow Parser can generate fixture NO_PROPS_EVENTS_ONLY_DEPRECATED_VIEW_CONFIG_NAME_OPTION 1`] = ` -"{ - 'modules': { - 'Module': { - 'type': 'Component', - 'components': { - 'Module': { - 'deprecatedViewConfigName': 'DeprecateModuleName', - 'extendsProps': [ - { - 'type': 'ReactNativeBuiltInType', - 'knownTypeName': 'ReactNativeCoreViewProps' - } - ], - 'events': [], - 'props': [], - 'commands': [] - } - } - } - } -}" -`; - -exports[`RN Codegen Flow Parser can generate fixture OBJECT_PROP_TYPES_NO_EVENTS 1`] = ` -"{ - 'modules': { - 'Module': { - 'type': 'Component', - 'components': { - 'Module': { - 'extendsProps': [ - { - 'type': 'ReactNativeBuiltInType', - 'knownTypeName': 'ReactNativeCoreViewProps' - } - ], - 'events': [], - 'props': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation', - 'default': false - } - } - ] - } - }, - { - 'name': 'boolean_optional', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation', - 'default': false - } - } - ] - } - }, - { - 'name': 'string_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } - }, - { - 'name': 'string_optional', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': '' - } - } - ] - } - }, - { - 'name': 'double_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation', - 'default': 0 - } - } - ] - } - }, - { - 'name': 'double_optional', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation', - 'default': 0 - } - } - ] - } - }, - { - 'name': 'float_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation', - 'default': 0 - } - } - ] - } - }, - { - 'name': 'float_optional', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation', - 'default': 0 - } - } - ] - } - }, - { - 'name': 'int_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation', - 'default': 0 - } - } - ] - } - }, - { - 'name': 'int_optional', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation', - 'default': 0 - } - } - ] - } - }, - { - 'name': 'enum_optional', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'StringEnumTypeAnnotation', - 'default': 'small', - 'options': [ - 'small', - 'large' - ] - } - } - } - ] - } - }, - { - 'name': 'image_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' - } - } - ] - } - }, - { - 'name': 'image_optional_key', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' - } - } - ] - } - }, - { - 'name': 'image_optional_value', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' - } - } - ] - } - }, - { - 'name': 'image_optional_both', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' - } - } - ] - } - }, - { - 'name': 'color_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - ] - } - }, - { - 'name': 'color_optional_key', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - ] - } - }, - { - 'name': 'color_optional_value', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - ] - } - }, - { - 'name': 'color_optional_both', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - ] - } - }, - { - 'name': 'processed_color_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - ] - } - }, - { - 'name': 'processed_color_optional_key', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - ] - } - }, - { - 'name': 'processed_color_optional_value', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - ] - } - }, - { - 'name': 'processed_color_optional_both', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - ] - } - }, - { - 'name': 'point_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' - } - } - ] - } - }, - { - 'name': 'point_optional_key', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' - } - } - ] - } - }, - { - 'name': 'point_optional_value', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' - } - } - ] - } - }, - { - 'name': 'point_optional_both', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' - } - } - ] - } - }, - { - 'name': 'insets_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' - } - } - ] - } - }, - { - 'name': 'insets_optional_key', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' - } - } - ] - } - }, - { - 'name': 'insets_optional_value', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' - } - } - ] - } - }, - { - 'name': 'insets_optional_both', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' - } - } - ] - } - }, - { - 'name': 'object_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'nestedProp', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } - } - ] - } - }, - { - 'name': 'object_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'nestedProp', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null + ] + } + }, + { + 'name': 'object_readonly_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } } - } - ] - } - } - ] - } - }, - { - 'name': 'object_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'nestedProp', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null + ] + } + }, + { + 'name': 'object_readonly_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } } - } - ] - } - } - ] - } - }, - { - 'name': 'object_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'nestedProp', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null + ] + } + }, + { + 'name': 'object_readonly_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } } - } - ] + ] + } + }, + { + 'name': 'object_readonly_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } } - } - ] + ] + } } } ], + 'props': [], 'commands': [] } } @@ -8898,13 +6922,14 @@ exports[`RN Codegen Flow Parser can generate fixture OBJECT_PROP_TYPES_NO_EVENTS }" `; -exports[`RN Codegen Flow Parser can generate fixture OBJECT_STATE_TYPES 1`] = ` +exports[`RN Codegen Flow Parser can generate fixture NO_PROPS_EVENTS_ONLY_DEPRECATED_VIEW_CONFIG_NAME_OPTION 1`] = ` "{ 'modules': { 'Module': { 'type': 'Component', 'components': { 'Module': { + 'deprecatedViewConfigName': 'DeprecateModuleName', 'extendsProps': [ { 'type': 'ReactNativeBuiltInType', @@ -8913,8 +6938,29 @@ exports[`RN Codegen Flow Parser can generate fixture OBJECT_STATE_TYPES 1`] = ` ], 'events': [], 'props': [], - 'commands': [], - 'state': [ + 'commands': [] + } + } + } + } +}" +`; + +exports[`RN Codegen Flow Parser can generate fixture OBJECT_PROP_TYPES_NO_EVENTS 1`] = ` +"{ + 'modules': { + 'Module': { + 'type': 'Component', + 'components': { + 'Module': { + 'extendsProps': [ + { + 'type': 'ReactNativeBuiltInType', + 'knownTypeName': 'ReactNativeCoreViewProps' + } + ], + 'events': [], + 'props': [ { 'name': 'boolean_required', 'optional': false, @@ -9553,7 +7599,8 @@ exports[`RN Codegen Flow Parser can generate fixture OBJECT_STATE_TYPES 1`] = ` ] } } - ] + ], + 'commands': [] } } } @@ -11373,102 +9420,3 @@ exports[`RN Codegen Flow Parser can generate fixture PROPS_AS_EXTERNAL_TYPES 1`] } }" `; - -exports[`RN Codegen Flow Parser can generate fixture STATE_NEGATIVE_DEFAULTS 1`] = ` -"{ - 'modules': { - 'Module': { - 'type': 'Component', - 'components': { - 'Module': { - 'extendsProps': [ - { - 'type': 'ReactNativeBuiltInType', - 'knownTypeName': 'ReactNativeCoreViewProps' - } - ], - 'events': [], - 'props': [], - 'commands': [], - 'state': [ - { - 'name': 'negative_float_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation', - 'default': -1 - } - }, - { - 'name': 'negative_int_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation', - 'default': -1 - } - }, - { - 'name': 'negative_double_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation', - 'default': -1 - } - } - ] - } - } - } - } -}" -`; - -exports[`RN Codegen Flow Parser can generate fixture STATE_WITH_IMAGES 1`] = ` -"{ - 'modules': { - 'Module': { - 'type': 'Component', - 'components': { - 'Module': { - 'extendsProps': [ - { - 'type': 'ReactNativeBuiltInType', - 'knownTypeName': 'ReactNativeCoreViewProps' - } - ], - 'events': [], - 'props': [ - { - 'name': 'imageSource', - 'optional': false, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' - } - } - ], - 'commands': [], - 'state': [ - { - 'name': 'imageSource', - 'optional': false, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' - } - }, - { - 'name': 'imageRequest', - 'optional': false, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageRequestPrimitive' - } - } - ] - } - } - } - } -}" -`; diff --git a/packages/react-native-codegen/src/parsers/flow/components/index.js b/packages/react-native-codegen/src/parsers/flow/components/index.js index 364a279d8f8f9a..a0b1eda6cdaaa9 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/index.js +++ b/packages/react-native-codegen/src/parsers/flow/components/index.js @@ -16,7 +16,6 @@ import type {ComponentSchemaBuilderConfig} from './schema.js'; const {getTypes} = require('../utils'); const {getCommands} = require('./commands'); const {getEvents} = require('./events'); -const {getState} = require('./states'); const {getExtendsProps, removeKnownExtends} = require('./extends'); const {getCommandOptions, getOptions} = require('./options'); const {getProps} = require('./props'); @@ -113,32 +112,8 @@ function findComponentConfig(ast) { throw new Error('codegenNativeCommands may only be called once in a file'); } - const unexportedStateTypes: Array = ast.body - .filter( - node => - node.type === 'TypeAlias' && node.id.name.indexOf('NativeState') >= 0, - ) - .map(node => node.id.name); - - const exportedStateTypes: Array = namedExports - .filter( - node => - node.declaration.id && - node.declaration.id.name.indexOf('NativeState') >= 0, - ) - .map(node => node.declaration.id.name); - - const stateTypeName = exportedStateTypes.concat(unexportedStateTypes); - - if (Array.isArray(stateTypeName) && stateTypeName.length > 1) { - throw new Error( - `Found ${stateTypeName.length} NativeStates for ${foundConfig.componentName}. Each component can have only 1 NativeState`, - ); - } - return { ...foundConfig, - stateTypeName: stateTypeName.length === 1 ? stateTypeName[0] : '', commandTypeName: commandsTypeNames[0] == null ? null @@ -211,7 +186,6 @@ function buildComponentSchema(ast): ComponentSchemaBuilderConfig { const { componentName, propsTypeName, - stateTypeName, commandTypeName, commandOptionsExpression, optionsExpression, @@ -236,7 +210,7 @@ function buildComponentSchema(ast): ComponentSchemaBuilderConfig { const events = getEvents(propProperties, types); const commands = getCommands(commandProperties, types); - const toRet = { + return { filename: componentName, componentName, options, @@ -245,17 +219,6 @@ function buildComponentSchema(ast): ComponentSchemaBuilderConfig { props, commands, }; - - if (stateTypeName) { - const stateProperties = getProperties(stateTypeName, types); - const state = getState(stateProperties, types); - return { - ...toRet, - state, - }; - } - - return toRet; } module.exports = { diff --git a/packages/react-native-codegen/src/parsers/flow/components/schema.js b/packages/react-native-codegen/src/parsers/flow/components/schema.js index e7bff107dbeba4..ed6223c3347b50 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/schema.js +++ b/packages/react-native-codegen/src/parsers/flow/components/schema.js @@ -15,7 +15,6 @@ import type { NamedShape, CommandTypeAnnotation, PropTypeAnnotation, - StateTypeAnnotation, ExtendsPropsShape, SchemaType, OptionsShape, @@ -28,7 +27,6 @@ export type ComponentSchemaBuilderConfig = $ReadOnly<{ events: $ReadOnlyArray, props: $ReadOnlyArray>, commands: $ReadOnlyArray>, - state?: $ReadOnlyArray>, options?: ?OptionsShape, }>; @@ -38,7 +36,6 @@ function wrapComponentSchema({ extendsProps, events, props, - state, options, commands, }: ComponentSchemaBuilderConfig): SchemaType { @@ -53,7 +50,6 @@ function wrapComponentSchema({ events, props, commands, - state, }, }, }, diff --git a/packages/react-native-codegen/src/parsers/flow/components/states.js b/packages/react-native-codegen/src/parsers/flow/components/states.js deleted file mode 100644 index 936aa3f11521cc..00000000000000 --- a/packages/react-native-codegen/src/parsers/flow/components/states.js +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict-local - * @format - */ - -'use strict'; - -const { - flattenProperties, - getSchemaInfo, - getTypeAnnotation, -} = require('./componentsUtils.js'); - -import type {StateTypeAnnotation, NamedShape} from '../../../CodegenSchema.js'; -import type {TypeDeclarationMap} from '../../utils'; - -// $FlowFixMe[unclear-type] there's no flowtype for ASTs -type PropAST = Object; - -function buildStateSchema( - property: PropAST, - types: TypeDeclarationMap, -): ?NamedShape { - const info = getSchemaInfo(property, types); - if (info == null) { - return null; - } - const {name, optional, typeAnnotation, defaultValue, withNullDefault} = info; - - return { - name, - optional, - typeAnnotation: getTypeAnnotation( - name, - typeAnnotation, - defaultValue, - withNullDefault, - types, - buildStateSchema, - ), - }; -} - -function getState( - typeDefinition: $ReadOnlyArray, - types: TypeDeclarationMap, -): $ReadOnlyArray> { - return flattenProperties(typeDefinition, types) - .map(property => buildStateSchema(property, types)) - .filter(Boolean); -} - -module.exports = { - getState, -}; diff --git a/packages/react-native-codegen/src/parsers/typescript/components/__test_fixtures__/failures.js b/packages/react-native-codegen/src/parsers/typescript/components/__test_fixtures__/failures.js index 130ec051317aa8..eefd9e316f18e5 100644 --- a/packages/react-native-codegen/src/parsers/typescript/components/__test_fixtures__/failures.js +++ b/packages/react-native-codegen/src/parsers/typescript/components/__test_fixtures__/failures.js @@ -485,310 +485,6 @@ export default codegenNativeComponent( ) as HostComponent; `; -// === STATE === -const NULLABLE_STATE_WITH_DEFAULT = ` -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const codegenNativeComponent = require('codegenNativeComponent'); - -import type {WithDefault, Float} from 'CodegenTypes'; -import type {ViewProps} from 'ViewPropTypes'; -import type {HostComponent} from 'react-native'; - -export interface ModuleProps extends ViewProps { } - -interface ModuleNativeState { - nullable_with_default: WithDefault | null | undefined; -} - -export default codegenNativeComponent( - 'Module', -) as HostComponent; -`; - -const NON_OPTIONAL_KEY_STATE_WITH_DEFAULT_VALUE = ` -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const codegenNativeComponent = require('codegenNativeComponent'); - -import type {WithDefault, Float} from 'CodegenTypes'; -import type {ViewProps} from 'ViewPropTypes'; -import type {HostComponent} from 'react-native'; - -export interface ModuleProps extends ViewProps {} - -export interface ModuleNativeState { - required_key_with_default: WithDefault; -} - -export default codegenNativeComponent( - 'Module', -) as HostComponent; -`; - -const STATE_CONFLICT_NAMES = ` -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const codegenNativeComponent = require('codegenNativeComponent'); - -import type {ViewProps} from 'ViewPropTypes'; -import type {HostComponent} from 'react-native'; - -export interface ModuleProps extends ViewProps { } - -interface ModuleNativeState { - isEnabled: string, - - isEnabled: boolean, -} - -export default codegenNativeComponent( - 'Module', -) as HostComponent; -`; - -const STATE_CONFLICT_WITH_SPREAD_PROPS = ` -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const codegenNativeComponent = require('codegenNativeComponent'); - -import type {ViewProps} from 'ViewPropTypes'; -import type {HostComponent} from 'react-native'; - -export interface ModuleProps extends ViewProps { } - -type PropsInFile = Readonly<{ - isEnabled: boolean, -}>; - -export interface ModuleNativeState extends PropsInFile { - isEnabled: boolean, -} - -export default codegenNativeComponent( - 'Module', -) as HostComponent; -`; - -const STATE_NUMBER_TYPE = ` -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const codegenNativeComponent = require('codegenNativeComponent'); - -import type {ViewProps} from 'ViewPropTypes'; -import type {HostComponent} from 'react-native'; - -export interface ModuleProps extends ViewProps { } - -interface ModuleNativeState { - someProp: number -} - -export default codegenNativeComponent( - 'Module', -) as HostComponent; -`; - -const STATE_MIXED_ENUM = ` -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const codegenNativeComponent = require('codegenNativeComponent'); - -import type {ViewProps} from 'ViewPropTypes'; -import type {HostComponent} from 'react-native'; -import type {WithDefault} from 'CodegenTypes'; - -export interface ModuleProps extends ViewProps { } - -export interface ModuleNativeState { - someProp?: WithDefault<'foo' | 1, 1>; -} - -export default codegenNativeComponent( - 'Module', -) as HostComponent; -`; - -const STATE_ENUM_BOOLEAN = ` -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const codegenNativeComponent = require('codegenNativeComponent'); - -import type {ViewProps} from 'ViewPropTypes'; -import type {HostComponent} from 'react-native'; -import type {WithDefault} from 'CodegenTypes'; - -export interface ModuleProps extends ViewProps { } - -interface ModuleNativeState { - someProp?: WithDefault -} - -export default codegenNativeComponent( - 'Module', -) as HostComponent; -`; - -const STATE_ARRAY_MIXED_ENUM = ` -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const codegenNativeComponent = require('codegenNativeComponent'); - -import type {ViewProps} from 'ViewPropTypes'; -import type {HostComponent} from 'react-native'; -import type {WithDefault} from 'CodegenTypes'; - -export interface ModuleProps extends ViewProps { } - -export interface ModuleNativeState { - someProp?: WithDefault, 1>; -} - -export default codegenNativeComponent( - 'Module', -) as HostComponent; -`; - -const STATE_ARRAY_ENUM_BOOLEAN = ` -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const codegenNativeComponent = require('codegenNativeComponent'); - -import type {ViewProps} from 'ViewPropTypes'; -import type {HostComponent} from 'react-native'; -import type {WithDefault} from 'CodegenTypes'; - -export interface ModuleProps extends ViewProps { } - -interface ModuleNativeState { - someProp?: WithDefault, false>; -} - -export default codegenNativeComponent( - 'Module', -) as HostComponent; -`; - -const STATE_ARRAY_ENUM_INT = ` -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const codegenNativeComponent = require('codegenNativeComponent'); - -import type {ViewProps} from 'ViewPropTypes'; -import type {HostComponent} from 'react-native'; -import type {WithDefault} from 'CodegenTypes'; - -export interface ModuleProps extends ViewProps { } - -export interface ModuleNativeState { - someProp?: WithDefault, 0>; -} - -export default codegenNativeComponent( - 'Module', -) as HostComponent; -`; - -const DOUBLE_STATE_IN_FILE = ` -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -const codegenNativeComponent = require('codegenNativeComponent'); - -import type {ViewProps} from 'ViewPropTypes'; -import type {HostComponent} from 'react-native'; - -export interface ModuleProps extends ViewProps { } - -interface SecondNativeState { - someProp: boolean -} - -export interface ModuleNativeState { - someOtherProp: boolean -} - -export default codegenNativeComponent( - 'Module', -) as HostComponent; -`; - module.exports = { COMMANDS_DEFINED_INLINE, COMMANDS_DEFINED_MULTIPLE_TIMES, @@ -806,15 +502,4 @@ module.exports = { PROP_ARRAY_MIXED_ENUM, PROP_ARRAY_ENUM_BOOLEAN, PROP_ARRAY_ENUM_INT, - NULLABLE_STATE_WITH_DEFAULT, - NON_OPTIONAL_KEY_STATE_WITH_DEFAULT_VALUE, - STATE_CONFLICT_NAMES, - STATE_CONFLICT_WITH_SPREAD_PROPS, - STATE_NUMBER_TYPE, - STATE_MIXED_ENUM, - STATE_ENUM_BOOLEAN, - STATE_ARRAY_MIXED_ENUM, - STATE_ARRAY_ENUM_BOOLEAN, - STATE_ARRAY_ENUM_INT, - DOUBLE_STATE_IN_FILE, }; diff --git a/packages/react-native-codegen/src/parsers/typescript/components/__test_fixtures__/fixtures.js b/packages/react-native-codegen/src/parsers/typescript/components/__test_fixtures__/fixtures.js index 05770b047cf3cb..4005574ba68dde 100644 --- a/packages/react-native-codegen/src/parsers/typescript/components/__test_fixtures__/fixtures.js +++ b/packages/react-native-codegen/src/parsers/typescript/components/__test_fixtures__/fixtures.js @@ -1034,7 +1034,7 @@ export default codegenNativeComponent('Module') as NativeType; `; -const COMMANDS_EVENTS_STATE_TYPES_EXPORTED = ` +const COMMANDS_EVENTS_TYPES_EXPORTED = ` /** * Copyright (c) Meta Platforms, Inc. and affiliates. * @@ -1138,599 +1138,6 @@ export default codegenNativeComponent('Module', { }) as HostComponent; `; -// === STATE === -const ALL_STATE_TYPES = ` -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const codegenNativeComponent = require('codegenNativeComponent'); - -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 {HostComponent} from 'react-native'; - -export interface ModuleProps extends ViewProps { } - -export interface ModuleNativeState { - // Props - // Boolean props - boolean_required: boolean; - boolean_optional_key?: WithDefault; - boolean_optional_both?: WithDefault; - - // Boolean props, null default - boolean_null_optional_key?: WithDefault; - boolean_null_optional_both?: WithDefault; - - // String props - string_required: string; - string_optional_key?: WithDefault; - string_optional_both?: WithDefault; - - // String props, null default - string_null_optional_key?: WithDefault; - string_null_optional_both?: WithDefault; - - // Stringish props - stringish_required: Stringish; - stringish_optional_key?: WithDefault; - stringish_optional_both?: WithDefault; - - // Stringish props, null default - stringish_null_optional_key?: WithDefault; - stringish_null_optional_both?: WithDefault; - - // Double props - double_required: Double; - double_optional_key?: WithDefault; - double_optional_both?: WithDefault; - - // Float props - float_required: Float; - float_optional_key?: WithDefault; - float_optional_both?: WithDefault; - - // Float props, null default - float_null_optional_key?: WithDefault; - float_null_optional_both?: WithDefault; - - // Float props, negative default - negative_float_optional_key?: WithDefault; - negative_float_optional_both?: WithDefault; - - // Int32 props - int32_required: Int32; - int32_optional_key?: WithDefault; - int32_optional_both?: WithDefault; - - // String enum props - enum_optional_key?: WithDefault<'small' | 'large', 'small'>; - enum_optional_both?: WithDefault<'small' | 'large', 'small'>; - - // Int enum props - int_enum_optional_key?: WithDefault<0 | 1, 0>; - - // Object props - object_optional_key?: Readonly<{prop: string}>; - object_optional_both?: Readonly<{prop: string} | null | undefined>; - object_optional_value: Readonly<{prop: string} | null | undefined>; - - // ImageSource props - image_required: ImageSource; - image_optional_value: ImageSource | null | undefined; - image_optional_both?: ImageSource | null | undefined; - - // ColorValue props - color_required: ColorValue; - color_optional_key?: ColorValue; - color_optional_value: ColorValue | null | undefined; - color_optional_both?: ColorValue | null | undefined; - - // ColorArrayValue props - color_array_required: ColorArrayValue; - color_array_optional_key?: ColorArrayValue; - color_array_optional_value: ColorArrayValue | null | undefined; - color_array_optional_both?: ColorArrayValue | null | undefined; - - // ProcessedColorValue props - processed_color_required: ProcessedColorValue; - processed_color_optional_key?: ProcessedColorValue; - processed_color_optional_value: ProcessedColorValue | null | undefined; - processed_color_optional_both?: ProcessedColorValue | null | undefined; - - // PointValue props - point_required: PointValue; - point_optional_key?: PointValue; - point_optional_value: PointValue | null | undefined; - point_optional_both?: PointValue | null | undefined; - - // EdgeInsets props - insets_required: EdgeInsetsValue; - insets_optional_key?: EdgeInsetsValue; - insets_optional_value: EdgeInsetsValue | null | undefined; - insets_optional_both?: EdgeInsetsValue | null | undefined; -} - -export default codegenNativeComponent( - 'Module', -) as HostComponent; -`; - -const STATE_NEGATIVE_DEFAULTS = ` -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const codegenNativeComponent = require('codegenNativeComponent'); - -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 {HostComponent} from 'react-native'; - -export interface ModuleProps extends ViewProps { } - -export interface ModuleNativeState { - - // Negative numbers default - negative_float_optional_key?: WithDefault; - negative_int_optional_key?: WithDefault; - negative_double_optional_key?: WithDefault; -} - -export default codegenNativeComponent( - 'Module', -) as HostComponent; -`; - -const ARRAY_STATE_TYPES = ` -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const codegenNativeComponent = require('codegenNativeComponent'); - -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 {HostComponent} from 'react-native'; - -type ObjectType = Readonly<{prop: string}>; -type ArrayObjectType = ReadonlyArray>; - -export interface ModuleProps extends ViewProps {} - -interface ModuleNativeState { - // Props - // Boolean props - array_boolean_required: ReadonlyArray; - array_boolean_optional_key?: ReadonlyArray; - array_boolean_optional_value: ReadonlyArray | null | undefined; - array_boolean_optional_both?: ReadonlyArray | null | undefined; - - // String props - array_string_required: ReadonlyArray; - array_string_optional_key?: ReadonlyArray; - array_string_optional_value: ReadonlyArray | null | undefined; - array_string_optional_both?: ReadonlyArray | null | undefined; - - // Double props - array_double_required: ReadonlyArray; - array_double_optional_key?: ReadonlyArray; - array_double_optional_value: ReadonlyArray | null | undefined; - array_double_optional_both?: ReadonlyArray | null | undefined; - - // Float props - array_float_required: ReadonlyArray; - array_float_optional_key?: ReadonlyArray; - array_float_optional_value: ReadonlyArray | null | undefined; - array_float_optional_both?: ReadonlyArray | null | undefined; - - // Int32 props - array_int32_required: ReadonlyArray; - array_int32_optional_key?: ReadonlyArray; - array_int32_optional_value: ReadonlyArray | null | undefined; - array_int32_optional_both?: ReadonlyArray | null | undefined; - - // String enum props - array_enum_optional_key?: WithDefault< - ReadonlyArray<'small' | 'large'>, - 'small' - >; - array_enum_optional_both?: WithDefault< - ReadonlyArray<'small' | 'large'>, - 'small' - >; - - // ImageSource props - array_image_required: ReadonlyArray; - array_image_optional_key?: ReadonlyArray; - array_image_optional_value: ReadonlyArray | null | undefined; - array_image_optional_both?: ReadonlyArray | null | undefined; - - // ColorValue props - array_color_required: ReadonlyArray; - array_color_optional_key?: ReadonlyArray; - array_color_optional_value: ReadonlyArray | null | undefined; - array_color_optional_both?: ReadonlyArray | null | undefined; - - // PointValue props - array_point_required: ReadonlyArray; - array_point_optional_key?: ReadonlyArray; - array_point_optional_value: ReadonlyArray | null | undefined; - array_point_optional_both?: ReadonlyArray | null | undefined; - - // EdgeInsetsValue props - array_insets_required: ReadonlyArray; - array_insets_optional_key?: ReadonlyArray; - array_insets_optional_value: ReadonlyArray | null | undefined; - array_insets_optional_both?: ReadonlyArray | null | undefined; - - // Object props - array_object_required: ReadonlyArray>; - array_object_optional_key?: ReadonlyArray>; - array_object_optional_value: ArrayObjectType | null | undefined; - array_object_optional_both?: ReadonlyArray | null | undefined; - - // Nested array object types - array_of_array_object_required: ReadonlyArray< - Readonly<{ - // This needs to be the same name as the top level array above - array_object_required: ReadonlyArray>; - }> - >; - array_of_array_object_optional_key?: ReadonlyArray< - Readonly<{ - // This needs to be the same name as the top level array above - array_object_optional_key: ReadonlyArray>; - }> - >; - array_of_array_object_optional_value: ReadonlyArray< - Readonly<{ - // This needs to be the same name as the top level array above - array_object_optional_value: ReadonlyArray< - Readonly<{prop: string | null | undefined}> - >; - }> - > | null | undefined; - array_of_array_object_optional_both?: ReadonlyArray< - Readonly<{ - // This needs to be the same name as the top level array above - array_object_optional_both: ReadonlyArray< - Readonly<{prop?: string | null | undefined}> - >; - }> - > | null | undefined; - - // Nested array of array of object types - array_of_array_of_object_required: ReadonlyArray< - ReadonlyArray< - Readonly<{ - prop: string; - }> - > - >; - - // Nested array of array of object types (in file) - array_of_array_of_object_required_in_file: ReadonlyArray< - ReadonlyArray - >; -} - -export default codegenNativeComponent( - 'Module', -) as HostComponent; -`; - -const ARRAY2_STATE_TYPES = ` -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const codegenNativeComponent = require('codegenNativeComponent'); - -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 {HostComponent} from 'react-native'; - -type ObjectType = Readonly<{prop: string}>; -type ArrayObjectType = readonly Readonly<{prop: string}>[]; - -export interface ModuleProps extends ViewProps {} - -export interface ModuleNativeState{ - // Props - // Boolean props - array_boolean_required: readonly boolean[]; - array_boolean_optional_key?: readonly boolean[]; - array_boolean_optional_value: readonly boolean[] | null | undefined; - array_boolean_optional_both?: readonly boolean[] | null | undefined; - - // String props - array_string_required: readonly string[]; - array_string_optional_key?: readonly string[]; - array_string_optional_value: readonly string[] | null | undefined; - array_string_optional_both?: readonly string[] | null | undefined; - - // Double props - array_double_required: readonly Double[]; - array_double_optional_key?: readonly Double[]; - array_double_optional_value: readonly Double[] | null | undefined; - array_double_optional_both?: readonly Double[] | null | undefined; - - // Float props - array_float_required: readonly Float[]; - array_float_optional_key?: readonly Float[]; - array_float_optional_value: readonly Float[] | null | undefined; - array_float_optional_both?: readonly Float[] | null | undefined; - - // Int32 props - array_int32_required: readonly Int32[]; - array_int32_optional_key?: readonly Int32[]; - array_int32_optional_value: readonly Int32[] | null | undefined; - array_int32_optional_both?: readonly Int32[] | null | undefined; - - // String enum props - array_enum_optional_key?: WithDefault< - readonly ('small' | 'large')[], - 'small' - >; - array_enum_optional_both?: WithDefault< - readonly ('small' | 'large')[], - 'small' - >; - - // ImageSource props - array_image_required: readonly ImageSource[]; - array_image_optional_key?: readonly ImageSource[]; - array_image_optional_value: readonly ImageSource[] | null | undefined; - array_image_optional_both?: readonly ImageSource[] | null | undefined; - - // ColorValue props - array_color_required: readonly ColorValue[]; - array_color_optional_key?: readonly ColorValue[]; - array_color_optional_value: readonly ColorValue[] | null | undefined; - array_color_optional_both?: readonly ColorValue[] | null | undefined; - - // PointValue props - array_point_required: readonly PointValue[]; - array_point_optional_key?: readonly PointValue[]; - array_point_optional_value: readonly PointValue[] | null | undefined; - array_point_optional_both?: readonly PointValue[] | null | undefined; - - // EdgeInsetsValue props - array_insets_required: readonly EdgeInsetsValue[]; - array_insets_optional_key?: readonly EdgeInsetsValue[]; - array_insets_optional_value: readonly EdgeInsetsValue[] | null | undefined; - array_insets_optional_both?: readonly EdgeInsetsValue[] | null | undefined; - - // Object props - array_object_required: readonly Readonly<{prop: string}>[]; - array_object_optional_key?: readonly Readonly<{prop: string}>[]; - array_object_optional_value: ArrayObjectType | null | undefined; - array_object_optional_both?: readonly ObjectType[] | null | undefined; - - // Nested array object types - array_of_array_object_required: readonly Readonly<{ - // This needs to be the same name as the top level array above - array_object_required: readonly Readonly<{prop: string}>[]; - }>[]; - array_of_array_object_optional_key?: readonly Readonly<{ - // This needs to be the same name as the top level array above - array_object_optional_key: readonly Readonly<{prop?: string}>[]; - }>[]; - array_of_array_object_optional_value: readonly Readonly<{ - // This needs to be the same name as the top level array above - array_object_optional_value: readonly Readonly<{prop: string | null | undefined}>[]; - }>[] | null | undefined; - array_of_array_object_optional_both?: readonly Readonly<{ - // This needs to be the same name as the top level array above - array_object_optional_both: readonly Readonly<{prop?: string | null | undefined}>[]; - }>[] | null | undefined; - - // Nested array of array of object types - array_of_array_of_object_required: readonly Readonly<{ - prop: string; - }>[][]; - - // Nested array of array of object types (in file) - array_of_array_of_object_required_in_file: readonly ObjectType[][]; -} - -export default codegenNativeComponent( - 'Module', -) as HostComponent; -`; - -const OBJECT_STATE_TYPES = ` -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const codegenNativeComponent = require('codegenNativeComponent'); - -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 {HostComponent} from 'react-native'; - -export interface ModuleProps extends ViewProps {} - -interface ModuleNativeState { - // Props - // Boolean props - boolean_required: Readonly<{prop: boolean}>; - boolean_optional: Readonly<{prop?: WithDefault}>; - - // String props - string_required: Readonly<{prop: string}>; - string_optional: Readonly<{prop?: WithDefault}>; - - // Double props - double_required: Readonly<{prop: Double}>; - double_optional: Readonly<{prop?: WithDefault}>; - - // Float props - float_required: Readonly<{prop: Float}>; - float_optional: Readonly<{prop?: WithDefault}>; - - // Int32 props - int_required: Readonly<{prop: Int32}>; - int_optional: Readonly<{prop?: WithDefault}>; - - // String enum props - enum_optional: Readonly<{ - prop?: WithDefault, 'small'>; - }>; - - // ImageSource props - image_required: Readonly<{prop: ImageSource}>; - image_optional_key: Readonly<{prop?: ImageSource}>; - image_optional_value: Readonly<{prop: ImageSource | null | undefined}>; - image_optional_both: Readonly<{prop?: ImageSource | null | undefined}>; - - // ColorValue props - color_required: Readonly<{prop: ColorValue}>; - color_optional_key: Readonly<{prop?: ColorValue}>; - color_optional_value: Readonly<{prop: ColorValue | null | undefined}>; - color_optional_both: Readonly<{prop?: ColorValue | null | undefined}>; - - // ProcessedColorValue props - processed_color_required: Readonly<{prop: ProcessedColorValue}>; - processed_color_optional_key: Readonly<{prop?: ProcessedColorValue}>; - processed_color_optional_value: Readonly<{ - prop: ProcessedColorValue | null | undefined; - }>; - processed_color_optional_both: Readonly<{ - prop?: ProcessedColorValue | null | undefined; - }>; - - // PointValue props - point_required: Readonly<{prop: PointValue}>; - point_optional_key: Readonly<{prop?: PointValue}>; - point_optional_value: Readonly<{prop: PointValue | null | undefined}>; - point_optional_both: Readonly<{prop?: PointValue | null | undefined}>; - - // EdgeInsetsValue props - insets_required: Readonly<{prop: EdgeInsetsValue}>; - insets_optional_key: Readonly<{prop?: EdgeInsetsValue}>; - insets_optional_value: Readonly<{prop: EdgeInsetsValue | null | undefined}>; - insets_optional_both: Readonly<{prop?: EdgeInsetsValue | null | undefined}>; - - // Nested object props - object_required: Readonly<{prop: Readonly<{nestedProp: string}>}>; - object_optional_key?: Readonly<{prop: Readonly<{nestedProp: string}>}>; - object_optional_value: Readonly<{ - prop: Readonly<{nestedProp: string}>; - }> | null | undefined; - object_optional_both?: Readonly<{ - prop: Readonly<{nestedProp: string}>; - }> | null | undefined; -} - -export default codegenNativeComponent( - 'Module', -) as HostComponent; -`; - -const STATE_WITH_IMAGES = ` -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict-local - */ - -'use strict'; - -const codegenNativeComponent = require('codegenNativeComponent'); -import type {ImageSource} from 'ImageSource'; - -export interface ModuleProps extends ViewProps { - imageSource: ImageSource; -} - -interface ModuleNativeState { - imageSource: ImageSource, - imageRequest: ImageRequest, -} - -export default codegenNativeComponent( - 'Module', -) as HostComponent; -`; - module.exports = { ALL_PROP_TYPES_NO_EVENTS, ARRAY_PROP_TYPES_NO_EVENTS, @@ -1743,15 +1150,9 @@ module.exports = { EVENTS_DEFINED_INLINE_WITH_ALL_TYPES, EVENTS_DEFINED_AS_NULL_INLINE, PROPS_AND_EVENTS_TYPES_EXPORTED, - COMMANDS_EVENTS_STATE_TYPES_EXPORTED, + COMMANDS_EVENTS_TYPES_EXPORTED, COMMANDS_DEFINED_WITH_ALL_TYPES, PROPS_AS_EXTERNAL_TYPES, COMMANDS_WITH_EXTERNAL_TYPES, PROPS_AND_EVENTS_WITH_INTERFACES, - ALL_STATE_TYPES, - ARRAY_STATE_TYPES, - ARRAY2_STATE_TYPES, - OBJECT_STATE_TYPES, - STATE_NEGATIVE_DEFAULTS, - STATE_WITH_IMAGES, }; diff --git a/packages/react-native-codegen/src/parsers/typescript/components/__tests__/__snapshots__/typescript-component-parser-test.js.snap b/packages/react-native-codegen/src/parsers/typescript/components/__tests__/__snapshots__/typescript-component-parser-test.js.snap index 9ae3ac9a7d561e..90947e1af64d3f 100644 --- a/packages/react-native-codegen/src/parsers/typescript/components/__tests__/__snapshots__/typescript-component-parser-test.js.snap +++ b/packages/react-native-codegen/src/parsers/typescript/components/__tests__/__snapshots__/typescript-component-parser-test.js.snap @@ -12,14 +12,8 @@ exports[`RN Codegen TypeScript Parser Fails with error message COMMANDS_DEFINED_ exports[`RN Codegen TypeScript Parser Fails with error message COMMANDS_DEFINED_WITHOUT_REF 1`] = `"The first argument of method hotspotUpdate must be of type React.ElementRef<>"`; -exports[`RN Codegen TypeScript Parser Fails with error message DOUBLE_STATE_IN_FILE 1`] = `"Found 2 NativeStates for Module. Each component can have only 1 NativeState"`; - -exports[`RN Codegen TypeScript Parser Fails with error message NON_OPTIONAL_KEY_STATE_WITH_DEFAULT_VALUE 1`] = `"key required_key_with_default must be optional if used with WithDefault<> annotation"`; - exports[`RN Codegen TypeScript Parser Fails with error message NON_OPTIONAL_KEY_WITH_DEFAULT_VALUE 1`] = `"key required_key_with_default must be optional if used with WithDefault<> annotation"`; -exports[`RN Codegen TypeScript Parser Fails with error message NULLABLE_STATE_WITH_DEFAULT 1`] = `"WithDefault<> is optional and does not need to be marked as optional. Please remove the union of undefined and/or null"`; - exports[`RN Codegen TypeScript Parser Fails with error message NULLABLE_WITH_DEFAULT 1`] = `"WithDefault<> is optional and does not need to be marked as optional. Please remove the union of undefined and/or null"`; exports[`RN Codegen TypeScript Parser Fails with error message PROP_ARRAY_ENUM_BOOLEAN 1`] = `"Unsupported union type for \\"someProp\\", received \\"BooleanLiteral\\""`; @@ -38,22 +32,6 @@ exports[`RN Codegen TypeScript Parser Fails with error message PROPS_CONFLICT_NA exports[`RN Codegen TypeScript Parser Fails with error message PROPS_CONFLICT_WITH_SPREAD_PROPS 1`] = `"A prop was already defined with the name isEnabled"`; -exports[`RN Codegen TypeScript Parser Fails with error message STATE_ARRAY_ENUM_BOOLEAN 1`] = `"Unsupported union type for \\"someProp\\", received \\"BooleanLiteral\\""`; - -exports[`RN Codegen TypeScript Parser Fails with error message STATE_ARRAY_ENUM_INT 1`] = `"Arrays of int enums are not supported (see: \\"someProp\\")"`; - -exports[`RN Codegen TypeScript Parser Fails with error message STATE_ARRAY_MIXED_ENUM 1`] = `"Mixed types are not supported (see \\"someProp\\")"`; - -exports[`RN Codegen TypeScript Parser Fails with error message STATE_CONFLICT_NAMES 1`] = `"A prop was already defined with the name isEnabled"`; - -exports[`RN Codegen TypeScript Parser Fails with error message STATE_CONFLICT_WITH_SPREAD_PROPS 1`] = `"A prop was already defined with the name isEnabled"`; - -exports[`RN Codegen TypeScript Parser Fails with error message STATE_ENUM_BOOLEAN 1`] = `"Unsupported union type for \\"someProp\\", received \\"BooleanLiteral\\""`; - -exports[`RN Codegen TypeScript Parser Fails with error message STATE_MIXED_ENUM 1`] = `"Mixed types are not supported (see \\"someProp\\")"`; - -exports[`RN Codegen TypeScript Parser Fails with error message STATE_NUMBER_TYPE 1`] = `"Cannot use \\"TSNumberKeyword\\" type annotation for \\"someProp\\": must use a specific numeric type like Int32, Double, or Float"`; - exports[`RN Codegen TypeScript Parser can generate fixture ALL_PROP_TYPES_NO_EVENTS 1`] = ` "{ 'modules': { @@ -569,7 +547,7 @@ exports[`RN Codegen TypeScript Parser can generate fixture ALL_PROP_TYPES_NO_EVE }" `; -exports[`RN Codegen TypeScript Parser can generate fixture ALL_STATE_TYPES 1`] = ` +exports[`RN Codegen TypeScript Parser can generate fixture ARRAY_PROP_TYPES_NO_EVENTS 1`] = ` "{ 'modules': { 'Module': { @@ -583,517 +561,669 @@ exports[`RN Codegen TypeScript Parser can generate fixture ALL_STATE_TYPES 1`] = } ], 'events': [], - 'props': [], - 'commands': [], - 'state': [ + 'props': [ { - 'name': 'boolean_required', + 'name': 'array_boolean_required', 'optional': false, 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation', - 'default': false - } - }, - { - 'name': 'boolean_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation', - 'default': true + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'BooleanTypeAnnotation' + } } }, { - 'name': 'boolean_optional_both', + 'name': 'array_boolean_optional_key', 'optional': true, 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation', - 'default': true + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'BooleanTypeAnnotation' + } } }, { - 'name': 'boolean_null_optional_key', + 'name': 'array_boolean_optional_value', 'optional': true, 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation', - 'default': null + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'BooleanTypeAnnotation' + } } }, { - 'name': 'boolean_null_optional_both', + 'name': 'array_boolean_optional_both', 'optional': true, 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation', - 'default': null + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'BooleanTypeAnnotation' + } } }, { - 'name': 'string_required', + 'name': 'array_string_required', 'optional': false, 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - }, - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': '' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'StringTypeAnnotation' + } } }, { - 'name': 'string_optional_both', + 'name': 'array_string_optional_key', 'optional': true, 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': '' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'StringTypeAnnotation' + } } }, { - 'name': 'string_null_optional_key', + 'name': 'array_string_optional_value', 'optional': true, 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'StringTypeAnnotation' + } } }, { - 'name': 'string_null_optional_both', + 'name': 'array_string_optional_both', 'optional': true, 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'StringTypeAnnotation' + } } }, { - 'name': 'stringish_required', + 'name': 'array_double_required', 'optional': false, 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'DoubleTypeAnnotation' + } } }, { - 'name': 'stringish_optional_key', + 'name': 'array_double_optional_key', 'optional': true, 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': '' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'DoubleTypeAnnotation' + } } }, { - 'name': 'stringish_optional_both', + 'name': 'array_double_optional_value', 'optional': true, 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': '' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'DoubleTypeAnnotation' + } } }, { - 'name': 'stringish_null_optional_key', + 'name': 'array_double_optional_both', 'optional': true, 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'DoubleTypeAnnotation' + } } }, { - 'name': 'stringish_null_optional_both', - 'optional': true, + 'name': 'array_float_required', + 'optional': false, 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'FloatTypeAnnotation' + } } }, { - 'name': 'double_required', - 'optional': false, + 'name': 'array_float_optional_key', + 'optional': true, 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation', - 'default': 0 + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'FloatTypeAnnotation' + } } }, { - 'name': 'double_optional_key', + 'name': 'array_float_optional_value', 'optional': true, 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation', - 'default': 1.1 + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'FloatTypeAnnotation' + } } }, { - 'name': 'double_optional_both', + 'name': 'array_float_optional_both', 'optional': true, 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation', - 'default': 1.1 + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'FloatTypeAnnotation' + } } }, { - 'name': 'float_required', + 'name': 'array_int32_required', 'optional': false, 'typeAnnotation': { - 'type': 'FloatTypeAnnotation', - 'default': 0 + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'Int32TypeAnnotation' + } } }, { - 'name': 'float_optional_key', + 'name': 'array_int32_optional_key', 'optional': true, 'typeAnnotation': { - 'type': 'FloatTypeAnnotation', - 'default': 1.1 + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'Int32TypeAnnotation' + } } }, { - 'name': 'float_optional_both', + 'name': 'array_int32_optional_value', 'optional': true, 'typeAnnotation': { - 'type': 'FloatTypeAnnotation', - 'default': 1.1 + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'Int32TypeAnnotation' + } } }, { - 'name': 'float_null_optional_key', + 'name': 'array_int32_optional_both', 'optional': true, 'typeAnnotation': { - 'type': 'FloatTypeAnnotation', - 'default': null + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'Int32TypeAnnotation' + } } }, { - 'name': 'float_null_optional_both', + 'name': 'array_enum_optional_key', 'optional': true, 'typeAnnotation': { - 'type': 'FloatTypeAnnotation', - 'default': null + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'StringEnumTypeAnnotation', + 'default': 'small', + 'options': [ + 'small', + 'large' + ] + } } }, { - 'name': 'negative_float_optional_key', + 'name': 'array_enum_optional_both', 'optional': true, 'typeAnnotation': { - 'type': 'FloatTypeAnnotation', - 'default': -1 + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'StringEnumTypeAnnotation', + 'default': 'small', + 'options': [ + 'small', + 'large' + ] + } } }, { - 'name': 'negative_float_optional_both', - 'optional': true, + 'name': 'array_image_required', + 'optional': false, 'typeAnnotation': { - 'type': 'FloatTypeAnnotation', - 'default': -1 + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ImageSourcePrimitive' + } } }, { - 'name': 'int32_required', - 'optional': false, + 'name': 'array_image_optional_key', + 'optional': true, 'typeAnnotation': { - 'type': 'Int32TypeAnnotation', - 'default': 0 + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ImageSourcePrimitive' + } } }, { - 'name': 'int32_optional_key', + 'name': 'array_image_optional_value', 'optional': true, 'typeAnnotation': { - 'type': 'Int32TypeAnnotation', - 'default': 1 + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ImageSourcePrimitive' + } } }, { - 'name': 'int32_optional_both', + 'name': 'array_image_optional_both', 'optional': true, 'typeAnnotation': { - 'type': 'Int32TypeAnnotation', - 'default': 1 + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ImageSourcePrimitive' + } } }, { - 'name': 'enum_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'default': 'small', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'enum_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'default': 'small', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'int_enum_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32EnumTypeAnnotation', - 'default': 0, - 'options': [ - 0, - 1 - ] - } - }, - { - 'name': 'object_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } - }, - { - 'name': 'object_optional_both', - 'optional': true, + 'name': 'array_color_required', + 'optional': false, 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ColorPrimitive' + } } }, { - 'name': 'object_optional_value', + 'name': 'array_color_optional_key', 'optional': true, 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } - }, - { - 'name': 'image_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ColorPrimitive' + } } }, { - 'name': 'image_optional_value', + 'name': 'array_color_optional_value', 'optional': true, 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ColorPrimitive' + } } }, { - 'name': 'image_optional_both', + 'name': 'array_color_optional_both', 'optional': true, 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ColorPrimitive' + } } }, { - 'name': 'color_required', + 'name': 'array_point_required', 'optional': false, 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'PointPrimitive' + } } }, { - 'name': 'color_optional_key', + 'name': 'array_point_optional_key', 'optional': true, 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'PointPrimitive' + } } }, { - 'name': 'color_optional_value', + 'name': 'array_point_optional_value', 'optional': true, 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'PointPrimitive' + } } }, { - 'name': 'color_optional_both', + 'name': 'array_point_optional_both', 'optional': true, 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'PointPrimitive' + } } }, { - 'name': 'color_array_required', + 'name': 'array_insets_required', 'optional': false, 'typeAnnotation': { 'type': 'ArrayTypeAnnotation', 'elementType': { 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' + 'name': 'EdgeInsetsPrimitive' } } }, { - 'name': 'color_array_optional_key', + 'name': 'array_insets_optional_key', 'optional': true, 'typeAnnotation': { 'type': 'ArrayTypeAnnotation', 'elementType': { 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' + 'name': 'EdgeInsetsPrimitive' } } }, { - 'name': 'color_array_optional_value', + 'name': 'array_insets_optional_value', 'optional': true, 'typeAnnotation': { 'type': 'ArrayTypeAnnotation', 'elementType': { 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' + 'name': 'EdgeInsetsPrimitive' } } }, { - 'name': 'color_array_optional_both', + 'name': 'array_insets_optional_both', 'optional': true, 'typeAnnotation': { 'type': 'ArrayTypeAnnotation', 'elementType': { 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' + 'name': 'EdgeInsetsPrimitive' } } }, { - 'name': 'processed_color_required', + 'name': 'array_object_required', 'optional': false, 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } } }, { - 'name': 'processed_color_optional_key', + 'name': 'array_object_optional_key', 'optional': true, 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } } }, { - 'name': 'processed_color_optional_value', + 'name': 'array_object_optional_value', 'optional': true, 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } } }, { - 'name': 'processed_color_optional_both', + 'name': 'array_object_optional_both', 'optional': true, 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } } }, { - 'name': 'point_required', + 'name': 'array_of_array_object_required', 'optional': false, 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' - } - }, - { - 'name': 'point_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' - } - }, - { - 'name': 'point_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'array_object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } + } + } + ] + } } }, { - 'name': 'point_optional_both', + 'name': 'array_of_array_object_optional_key', 'optional': true, 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'array_object_optional_key', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } + } + } + ] + } } }, { - 'name': 'insets_required', - 'optional': false, + 'name': 'array_of_array_object_optional_value', + 'optional': true, 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'array_object_optional_value', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } + } + } + ] + } } }, { - 'name': 'insets_optional_key', + 'name': 'array_of_array_object_optional_both', 'optional': true, 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'array_object_optional_both', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } + } + } + ] + } } }, { - 'name': 'insets_optional_value', - 'optional': true, + 'name': 'array_of_array_of_object_required', + 'optional': false, 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } + } } }, { - 'name': 'insets_optional_both', - 'optional': true, + 'name': 'array_of_array_of_object_required_in_file', + 'optional': false, 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } + } } } - ] + ], + 'commands': [] } } } @@ -1101,7 +1231,7 @@ exports[`RN Codegen TypeScript Parser can generate fixture ALL_STATE_TYPES 1`] = }" `; -exports[`RN Codegen TypeScript Parser can generate fixture ARRAY_PROP_TYPES_NO_EVENTS 1`] = ` +exports[`RN Codegen TypeScript Parser can generate fixture ARRAY2_PROP_TYPES_NO_EVENTS 1`] = ` "{ 'modules': { 'Module': { @@ -1785,7 +1915,7 @@ exports[`RN Codegen TypeScript Parser can generate fixture ARRAY_PROP_TYPES_NO_E }" `; -exports[`RN Codegen TypeScript Parser can generate fixture ARRAY_STATE_TYPES 1`] = ` +exports[`RN Codegen TypeScript Parser can generate fixture COMMANDS_DEFINED_WITH_ALL_TYPES 1`] = ` "{ 'modules': { 'Module': { @@ -1800,5462 +1930,491 @@ exports[`RN Codegen TypeScript Parser can generate fixture ARRAY_STATE_TYPES 1`] ], 'events': [], 'props': [], - 'commands': [], - 'state': [ + 'commands': [ { - 'name': 'array_boolean_required', + 'name': 'handleRootTag', 'optional': false, 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'BooleanTypeAnnotation' + 'type': 'FunctionTypeAnnotation', + 'params': [ + { + 'name': 'rootTag', + 'typeAnnotation': { + 'type': 'ReservedTypeAnnotation', + 'name': 'RootTag' + } + } + ], + 'returnTypeAnnotation': { + 'type': 'VoidTypeAnnotation' } } }, { - 'name': 'array_boolean_optional_key', - 'optional': true, + 'name': 'hotspotUpdate', + 'optional': false, 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'BooleanTypeAnnotation' + 'type': 'FunctionTypeAnnotation', + 'params': [ + { + 'name': 'x', + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'y', + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ], + 'returnTypeAnnotation': { + 'type': 'VoidTypeAnnotation' } } }, { - 'name': 'array_boolean_optional_value', - 'optional': true, + 'name': 'scrollTo', + 'optional': false, 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'BooleanTypeAnnotation' + 'type': 'FunctionTypeAnnotation', + 'params': [ + { + 'name': 'x', + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'y', + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'z', + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'animated', + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ], + 'returnTypeAnnotation': { + 'type': 'VoidTypeAnnotation' } } - }, - { - 'name': 'array_boolean_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'BooleanTypeAnnotation' - } - } - }, - { - 'name': 'array_string_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'StringTypeAnnotation' - } - } - }, - { - 'name': 'array_string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'StringTypeAnnotation' - } - } - }, - { - 'name': 'array_string_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'StringTypeAnnotation' - } - } - }, - { - 'name': 'array_string_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'StringTypeAnnotation' - } - } - }, - { - 'name': 'array_double_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'DoubleTypeAnnotation' - } - } - }, - { - 'name': 'array_double_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'DoubleTypeAnnotation' - } - } - }, - { - 'name': 'array_double_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'DoubleTypeAnnotation' - } - } - }, - { - 'name': 'array_double_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'DoubleTypeAnnotation' - } - } - }, - { - 'name': 'array_float_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'FloatTypeAnnotation' - } - } - }, - { - 'name': 'array_float_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'FloatTypeAnnotation' - } - } - }, - { - 'name': 'array_float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'FloatTypeAnnotation' - } - } - }, - { - 'name': 'array_float_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'FloatTypeAnnotation' - } - } - }, - { - 'name': 'array_int32_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'Int32TypeAnnotation' - } - } - }, - { - 'name': 'array_int32_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'Int32TypeAnnotation' - } - } - }, - { - 'name': 'array_int32_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'Int32TypeAnnotation' - } - } - }, - { - 'name': 'array_int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'Int32TypeAnnotation' - } - } - }, - { - 'name': 'array_enum_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'StringEnumTypeAnnotation', - 'default': 'small', - 'options': [ - 'small', - 'large' - ] - } - } - }, + } + ] + } + } + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture COMMANDS_EVENTS_TYPES_EXPORTED 1`] = ` +"{ + 'modules': { + 'Module': { + 'type': 'Component', + 'components': { + 'Module': { + 'extendsProps': [ { - 'name': 'array_enum_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'StringEnumTypeAnnotation', - 'default': 'small', - 'options': [ - 'small', - 'large' - ] - } - } - }, + 'type': 'ReactNativeBuiltInType', + 'knownTypeName': 'ReactNativeCoreViewProps' + } + ], + 'events': [ { - 'name': 'array_image_required', + 'name': 'onBubblingEventDefinedInline', 'optional': false, + 'bubblingType': 'bubble', 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' - } - } - }, - { - 'name': 'array_image_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' - } - } - }, - { - 'name': 'array_image_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' - } - } - }, - { - 'name': 'array_image_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' - } - } - }, - { - 'name': 'array_color_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - }, - { - 'name': 'array_color_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - }, - { - 'name': 'array_color_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - }, - { - 'name': 'array_color_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - }, - { - 'name': 'array_point_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' - } - } - }, - { - 'name': 'array_point_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' - } - } - }, - { - 'name': 'array_point_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' - } - } - }, - { - 'name': 'array_point_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' - } - } - }, - { - 'name': 'array_insets_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' - } - } - }, - { - 'name': 'array_insets_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' - } - } - }, - { - 'name': 'array_insets_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' - } - } - }, - { - 'name': 'array_insets_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' - } - } - }, - { - 'name': 'array_object_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { + 'type': 'EventTypeAnnotation', + 'argument': { 'type': 'ObjectTypeAnnotation', 'properties': [ { - 'name': 'prop', + 'name': 'boolean_required', 'optional': false, 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null + 'type': 'BooleanTypeAnnotation' } - } - ] - } - } - }, - { - 'name': 'array_object_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ + }, { - 'name': 'prop', - 'optional': false, + 'name': 'boolean_optional_key', + 'optional': true, 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null + 'type': 'BooleanTypeAnnotation' } - } - ] - } - } - }, - { - 'name': 'array_object_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ + }, { - 'name': 'prop', - 'optional': false, + 'name': 'boolean_optional_value', + 'optional': true, 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null + 'type': 'BooleanTypeAnnotation' } - } - ] - } - } - }, - { - 'name': 'array_object_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ + }, { - 'name': 'prop', - 'optional': false, + 'name': 'boolean_optional_both', + 'optional': true, 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null + 'type': 'BooleanTypeAnnotation' } - } - ] - } - } - }, - { - 'name': 'array_of_array_object_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ + }, { - 'name': 'array_object_required', + 'name': 'string_required', 'optional': false, 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } + 'type': 'StringTypeAnnotation' } - } - ] - } - } - }, - { - 'name': 'array_of_array_object_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ + }, { - 'name': 'array_object_optional_key', + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_required', 'optional': false, 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } + 'type': 'DoubleTypeAnnotation' } - } - ] - } - } - }, - { - 'name': 'array_of_array_object_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ + }, { - 'name': 'array_object_optional_value', + 'name': 'double_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_required', 'optional': false, 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } + 'type': 'FloatTypeAnnotation' } - } - ] - } - } - }, - { - 'name': 'array_of_array_object_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ + }, { - 'name': 'array_object_optional_both', + 'name': 'float_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_required', 'optional': false, 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } + 'type': 'Int32TypeAnnotation' } - } - ] - } - } - }, - { - 'name': 'array_of_array_of_object_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } + }, + { + 'name': 'int32_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' } - ] - } - } - } - }, - { - 'name': 'array_of_array_of_object_required_in_file', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } + }, + { + 'name': 'int32_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' } - ] - } - } - } - } - ] - } - } - } - } -}" -`; - -exports[`RN Codegen TypeScript Parser can generate fixture ARRAY2_PROP_TYPES_NO_EVENTS 1`] = ` -"{ - 'modules': { - 'Module': { - 'type': 'Component', - 'components': { - 'Module': { - 'extendsProps': [ - { - 'type': 'ReactNativeBuiltInType', - 'knownTypeName': 'ReactNativeCoreViewProps' - } - ], - 'events': [], - 'props': [ - { - 'name': 'array_boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'BooleanTypeAnnotation' - } - } - }, - { - 'name': 'array_boolean_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'BooleanTypeAnnotation' - } - } - }, - { - 'name': 'array_boolean_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'BooleanTypeAnnotation' - } - } - }, - { - 'name': 'array_boolean_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'BooleanTypeAnnotation' + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'enum_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_required_nested_2_layers', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'object_optional_nested_1_layer', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + }, + { + 'name': 'object_readonly_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] } } }, { - 'name': 'array_string_required', + 'name': 'onBubblingEventDefinedInlineWithPaperName', 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'StringTypeAnnotation' - } - } - }, - { - 'name': 'array_string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'StringTypeAnnotation' - } - } - }, - { - 'name': 'array_string_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'StringTypeAnnotation' - } - } - }, - { - 'name': 'array_string_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'StringTypeAnnotation' - } - } - }, - { - 'name': 'array_double_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'DoubleTypeAnnotation' - } - } - }, - { - 'name': 'array_double_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'DoubleTypeAnnotation' - } - } - }, - { - 'name': 'array_double_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'DoubleTypeAnnotation' - } - } - }, - { - 'name': 'array_double_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'DoubleTypeAnnotation' - } - } - }, - { - 'name': 'array_float_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'FloatTypeAnnotation' - } - } - }, - { - 'name': 'array_float_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'FloatTypeAnnotation' - } - } - }, - { - 'name': 'array_float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'FloatTypeAnnotation' - } - } - }, - { - 'name': 'array_float_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'FloatTypeAnnotation' - } - } - }, - { - 'name': 'array_int32_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'Int32TypeAnnotation' - } - } - }, - { - 'name': 'array_int32_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'Int32TypeAnnotation' - } - } - }, - { - 'name': 'array_int32_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'Int32TypeAnnotation' - } - } - }, - { - 'name': 'array_int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'Int32TypeAnnotation' - } - } - }, - { - 'name': 'array_enum_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'StringEnumTypeAnnotation', - 'default': 'small', - 'options': [ - 'small', - 'large' - ] - } - } - }, - { - 'name': 'array_enum_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'StringEnumTypeAnnotation', - 'default': 'small', - 'options': [ - 'small', - 'large' - ] - } - } - }, - { - 'name': 'array_image_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' - } - } - }, - { - 'name': 'array_image_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' - } - } - }, - { - 'name': 'array_image_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' - } - } - }, - { - 'name': 'array_image_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' - } - } - }, - { - 'name': 'array_color_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - }, - { - 'name': 'array_color_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - }, - { - 'name': 'array_color_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - }, - { - 'name': 'array_color_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - }, - { - 'name': 'array_point_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' - } - } - }, - { - 'name': 'array_point_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' - } - } - }, - { - 'name': 'array_point_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' - } - } - }, - { - 'name': 'array_point_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' - } - } - }, - { - 'name': 'array_insets_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' - } - } - }, - { - 'name': 'array_insets_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' - } - } - }, - { - 'name': 'array_insets_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' - } - } - }, - { - 'name': 'array_insets_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' - } - } - }, - { - 'name': 'array_object_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } - } - }, - { - 'name': 'array_object_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } - } - }, - { - 'name': 'array_object_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } - } - }, - { - 'name': 'array_object_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } - } - }, - { - 'name': 'array_of_array_object_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'array_object_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } - } - } - ] - } - } - }, - { - 'name': 'array_of_array_object_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'array_object_optional_key', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } - } - } - ] - } - } - }, - { - 'name': 'array_of_array_object_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'array_object_optional_value', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } - } - } - ] - } - } - }, - { - 'name': 'array_of_array_object_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'array_object_optional_both', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } - } - } - ] - } - } - }, - { - 'name': 'array_of_array_of_object_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } - } - } - }, - { - 'name': 'array_of_array_of_object_required_in_file', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } - } - } - } - ], - 'commands': [] - } - } - } - } -}" -`; - -exports[`RN Codegen TypeScript Parser can generate fixture ARRAY2_STATE_TYPES 1`] = ` -"{ - 'modules': { - 'Module': { - 'type': 'Component', - 'components': { - 'Module': { - 'extendsProps': [ - { - 'type': 'ReactNativeBuiltInType', - 'knownTypeName': 'ReactNativeCoreViewProps' - } - ], - 'events': [], - 'props': [], - 'commands': [], - 'state': [ - { - 'name': 'array_boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'BooleanTypeAnnotation' - } - } - }, - { - 'name': 'array_boolean_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'BooleanTypeAnnotation' - } - } - }, - { - 'name': 'array_boolean_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'BooleanTypeAnnotation' - } - } - }, - { - 'name': 'array_boolean_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'BooleanTypeAnnotation' - } - } - }, - { - 'name': 'array_string_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'StringTypeAnnotation' - } - } - }, - { - 'name': 'array_string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'StringTypeAnnotation' - } - } - }, - { - 'name': 'array_string_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'StringTypeAnnotation' - } - } - }, - { - 'name': 'array_string_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'StringTypeAnnotation' - } - } - }, - { - 'name': 'array_double_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'DoubleTypeAnnotation' - } - } - }, - { - 'name': 'array_double_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'DoubleTypeAnnotation' - } - } - }, - { - 'name': 'array_double_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'DoubleTypeAnnotation' - } - } - }, - { - 'name': 'array_double_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'DoubleTypeAnnotation' - } - } - }, - { - 'name': 'array_float_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'FloatTypeAnnotation' - } - } - }, - { - 'name': 'array_float_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'FloatTypeAnnotation' - } - } - }, - { - 'name': 'array_float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'FloatTypeAnnotation' - } - } - }, - { - 'name': 'array_float_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'FloatTypeAnnotation' - } - } - }, - { - 'name': 'array_int32_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'Int32TypeAnnotation' - } - } - }, - { - 'name': 'array_int32_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'Int32TypeAnnotation' - } - } - }, - { - 'name': 'array_int32_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'Int32TypeAnnotation' - } - } - }, - { - 'name': 'array_int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'Int32TypeAnnotation' - } - } - }, - { - 'name': 'array_enum_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'StringEnumTypeAnnotation', - 'default': 'small', - 'options': [ - 'small', - 'large' - ] - } - } - }, - { - 'name': 'array_enum_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'StringEnumTypeAnnotation', - 'default': 'small', - 'options': [ - 'small', - 'large' - ] - } - } - }, - { - 'name': 'array_image_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' - } - } - }, - { - 'name': 'array_image_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' - } - } - }, - { - 'name': 'array_image_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' - } - } - }, - { - 'name': 'array_image_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' - } - } - }, - { - 'name': 'array_color_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - }, - { - 'name': 'array_color_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - }, - { - 'name': 'array_color_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - }, - { - 'name': 'array_color_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - }, - { - 'name': 'array_point_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' - } - } - }, - { - 'name': 'array_point_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' - } - } - }, - { - 'name': 'array_point_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' - } - } - }, - { - 'name': 'array_point_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' - } - } - }, - { - 'name': 'array_insets_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' - } - } - }, - { - 'name': 'array_insets_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' - } - } - }, - { - 'name': 'array_insets_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' - } - } - }, - { - 'name': 'array_insets_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' - } - } - }, - { - 'name': 'array_object_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } - } - }, - { - 'name': 'array_object_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } - } - }, - { - 'name': 'array_object_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } - } - }, - { - 'name': 'array_object_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } - } - }, - { - 'name': 'array_of_array_object_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'array_object_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } - } - } - ] - } - } - }, - { - 'name': 'array_of_array_object_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'array_object_optional_key', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } - } - } - ] - } - } - }, - { - 'name': 'array_of_array_object_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'array_object_optional_value', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } - } - } - ] - } - } - }, - { - 'name': 'array_of_array_object_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'array_object_optional_both', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } - } - } - ] - } - } - }, - { - 'name': 'array_of_array_of_object_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } - } - } - }, - { - 'name': 'array_of_array_of_object_required_in_file', - 'optional': false, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } - } - } - } - ] - } - } - } - } -}" -`; - -exports[`RN Codegen TypeScript Parser can generate fixture COMMANDS_DEFINED_WITH_ALL_TYPES 1`] = ` -"{ - 'modules': { - 'Module': { - 'type': 'Component', - 'components': { - 'Module': { - 'extendsProps': [ - { - 'type': 'ReactNativeBuiltInType', - 'knownTypeName': 'ReactNativeCoreViewProps' - } - ], - 'events': [], - 'props': [], - 'commands': [ - { - 'name': 'handleRootTag', - 'optional': false, - 'typeAnnotation': { - 'type': 'FunctionTypeAnnotation', - 'params': [ - { - 'name': 'rootTag', - 'typeAnnotation': { - 'type': 'ReservedTypeAnnotation', - 'name': 'RootTag' - } - } - ], - 'returnTypeAnnotation': { - 'type': 'VoidTypeAnnotation' - } - } - }, - { - 'name': 'hotspotUpdate', - 'optional': false, - 'typeAnnotation': { - 'type': 'FunctionTypeAnnotation', - 'params': [ - { - 'name': 'x', - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'y', - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - } - ], - 'returnTypeAnnotation': { - 'type': 'VoidTypeAnnotation' - } - } - }, - { - 'name': 'scrollTo', - 'optional': false, - 'typeAnnotation': { - 'type': 'FunctionTypeAnnotation', - 'params': [ - { - 'name': 'x', - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'y', - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'z', - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'animated', - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - } - ], - 'returnTypeAnnotation': { - 'type': 'VoidTypeAnnotation' - } - } - } - ] - } - } - } - } -}" -`; - -exports[`RN Codegen TypeScript Parser can generate fixture COMMANDS_EVENTS_STATE_TYPES_EXPORTED 1`] = ` -"{ - 'modules': { - 'Module': { - 'type': 'Component', - 'components': { - 'Module': { - 'extendsProps': [ - { - 'type': 'ReactNativeBuiltInType', - 'knownTypeName': 'ReactNativeCoreViewProps' - } - ], - 'events': [ - { - 'name': 'onBubblingEventDefinedInline', - 'optional': false, - 'bubblingType': 'bubble', - 'typeAnnotation': { - 'type': 'EventTypeAnnotation', - 'argument': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'boolean_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'boolean_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'boolean_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'string_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'string_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'string_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'double_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'double_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'double_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'double_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'float_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'float_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'float_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'int32_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'int32_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'int32_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'enum_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'enum_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'enum_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'enum_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'object_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_required_nested_2_layers', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'object_optional_nested_1_layer', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'double_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - } - ] - } - } - ] - } - }, - { - 'name': 'object_readonly_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_readonly_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_readonly_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_readonly_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - } - ] - } - } - ] - } - } - }, - { - 'name': 'onBubblingEventDefinedInlineWithPaperName', - 'optional': false, - 'bubblingType': 'bubble', - 'paperTopLevelNameDeprecated': 'paperBubblingEventDefinedInlineWithPaperName', - 'typeAnnotation': { - 'type': 'EventTypeAnnotation', - 'argument': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'boolean_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'boolean_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'boolean_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'string_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'string_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'string_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'double_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'double_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'double_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'double_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'float_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'float_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'float_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'int32_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'int32_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'int32_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'enum_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'enum_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'enum_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'enum_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'object_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_required_nested_2_layers', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'object_optional_nested_1_layer', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'double_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - } - ] - } - } - ] - } - }, - { - 'name': 'object_readonly_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_readonly_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_readonly_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_readonly_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - } - ] - } - } - ] - } - } - }, - { - 'name': 'onDirectEventDefinedInline', - 'optional': false, - 'bubblingType': 'direct', - 'typeAnnotation': { - 'type': 'EventTypeAnnotation', - 'argument': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'boolean_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'boolean_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'boolean_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'string_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'string_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'string_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'double_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'double_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'double_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'double_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'float_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'float_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'float_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'int32_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'int32_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'int32_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'enum_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'enum_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'enum_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'enum_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'object_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_required_nested_2_layers', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'object_optional_nested_1_layer', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'double_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - } - ] - } - } - ] - } - }, - { - 'name': 'object_readonly_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_readonly_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_readonly_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_readonly_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - } - ] - } - } - ] - } - } - }, - { - 'name': 'onDirectEventDefinedInlineWithPaperName', - 'optional': false, - 'bubblingType': 'direct', - 'paperTopLevelNameDeprecated': 'paperDirectEventDefinedInlineWithPaperName', - 'typeAnnotation': { - 'type': 'EventTypeAnnotation', - 'argument': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'boolean_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'boolean_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'boolean_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'string_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'string_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'string_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'double_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'double_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'double_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'double_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'float_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'float_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'float_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'int32_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'int32_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'int32_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'enum_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'enum_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'enum_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'enum_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'object_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_required_nested_2_layers', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'object_optional_nested_1_layer', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'double_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - } - ] - } - } - ] - } - }, - { - 'name': 'object_readonly_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_readonly_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_readonly_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_readonly_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - } - ] - } - } - ] - } - } - } - ], - 'props': [], - 'commands': [ - { - 'name': 'scrollTo', - 'optional': false, - 'typeAnnotation': { - 'type': 'FunctionTypeAnnotation', - 'params': [ - { - 'name': 'y', - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'animated', - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - } - ], - 'returnTypeAnnotation': { - 'type': 'VoidTypeAnnotation' - } - } - } - ], - 'state': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation', - 'default': false - } - }, - { - 'name': 'boolean_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation', - 'default': true - } - }, - { - 'name': 'boolean_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation', - 'default': true - } - } - ] - } - } - } - } -}" -`; - -exports[`RN Codegen TypeScript Parser can generate fixture COMMANDS_WITH_EXTERNAL_TYPES 1`] = ` -"{ - 'modules': { - 'Module': { - 'type': 'Component', - 'components': { - 'Module': { - 'extendsProps': [ - { - 'type': 'ReactNativeBuiltInType', - 'knownTypeName': 'ReactNativeCoreViewProps' - } - ], - 'events': [], - 'props': [], - 'commands': [ - { - 'name': 'scrollTo', - 'optional': false, - 'typeAnnotation': { - 'type': 'FunctionTypeAnnotation', - 'params': [ - { - 'name': 'y', - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'animated', - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - } - ], - 'returnTypeAnnotation': { - 'type': 'VoidTypeAnnotation' - } - } - } - ] - } - } - } - } -}" -`; - -exports[`RN Codegen TypeScript Parser can generate fixture EVENTS_DEFINED_AS_NULL_INLINE 1`] = ` -"{ - 'modules': { - 'Module': { - 'type': 'Component', - 'components': { - 'Module': { - 'extendsProps': [ - { - 'type': 'ReactNativeBuiltInType', - 'knownTypeName': 'ReactNativeCoreViewProps' - } - ], - 'events': [ - { - 'name': 'onDirectEventDefinedInlineNull', - 'optional': false, - 'bubblingType': 'direct', - 'typeAnnotation': { - 'type': 'EventTypeAnnotation', - 'argument': { - 'type': 'ObjectTypeAnnotation', - 'properties': [] - } - } - }, - { - 'name': 'onDirectEventDefinedInlineNullOptionalKey', - 'optional': true, - 'bubblingType': 'direct', - 'typeAnnotation': { - 'type': 'EventTypeAnnotation', - 'argument': { - 'type': 'ObjectTypeAnnotation', - 'properties': [] - } - } - }, - { - 'name': 'onDirectEventDefinedInlineNullOptionalValue', - 'optional': true, - 'bubblingType': 'direct', - 'typeAnnotation': { - 'type': 'EventTypeAnnotation', - 'argument': { - 'type': 'ObjectTypeAnnotation', - 'properties': [] - } - } - }, - { - 'name': 'onDirectEventDefinedInlineNullOptionalBoth', - 'optional': true, - 'bubblingType': 'direct', - 'typeAnnotation': { - 'type': 'EventTypeAnnotation', - 'argument': { - 'type': 'ObjectTypeAnnotation', - 'properties': [] - } - } - }, - { - 'name': 'onDirectEventDefinedInlineNullWithPaperName', - 'optional': true, - 'bubblingType': 'direct', - 'paperTopLevelNameDeprecated': 'paperDirectEventDefinedInlineNullWithPaperName', - 'typeAnnotation': { - 'type': 'EventTypeAnnotation', - 'argument': { - 'type': 'ObjectTypeAnnotation', - 'properties': [] - } - } - }, - { - 'name': 'onBubblingEventDefinedInlineNull', - 'optional': false, - 'bubblingType': 'bubble', - 'typeAnnotation': { - 'type': 'EventTypeAnnotation', - 'argument': { - 'type': 'ObjectTypeAnnotation', - 'properties': [] - } - } - }, - { - 'name': 'onBubblingEventDefinedInlineNullOptionalKey', - 'optional': true, - 'bubblingType': 'bubble', - 'typeAnnotation': { - 'type': 'EventTypeAnnotation', - 'argument': { - 'type': 'ObjectTypeAnnotation', - 'properties': [] - } - } - }, - { - 'name': 'onBubblingEventDefinedInlineNullOptionalValue', - 'optional': true, - 'bubblingType': 'bubble', - 'typeAnnotation': { - 'type': 'EventTypeAnnotation', - 'argument': { - 'type': 'ObjectTypeAnnotation', - 'properties': [] - } - } - }, - { - 'name': 'onBubblingEventDefinedInlineNullOptionalBoth', - 'optional': true, - 'bubblingType': 'bubble', - 'typeAnnotation': { - 'type': 'EventTypeAnnotation', - 'argument': { - 'type': 'ObjectTypeAnnotation', - 'properties': [] - } - } - }, - { - 'name': 'onBubblingEventDefinedInlineNullWithPaperName', - 'optional': true, - 'bubblingType': 'bubble', - 'paperTopLevelNameDeprecated': 'paperBubblingEventDefinedInlineNullWithPaperName', - 'typeAnnotation': { - 'type': 'EventTypeAnnotation', - 'argument': { - 'type': 'ObjectTypeAnnotation', - 'properties': [] - } - } - } - ], - 'props': [], - 'commands': [] - } - } - } - } -}" -`; - -exports[`RN Codegen TypeScript Parser can generate fixture EVENTS_DEFINED_INLINE_WITH_ALL_TYPES 1`] = ` -"{ - 'modules': { - 'Module': { - 'type': 'Component', - 'components': { - 'Module': { - 'extendsProps': [ - { - 'type': 'ReactNativeBuiltInType', - 'knownTypeName': 'ReactNativeCoreViewProps' - } - ], - 'events': [ - { - 'name': 'onDirectEventDefinedInline', - 'optional': false, - 'bubblingType': 'direct', - 'typeAnnotation': { - 'type': 'EventTypeAnnotation', - 'argument': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'boolean_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'boolean_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'boolean_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'string_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'string_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'string_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'double_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'double_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'double_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'double_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'float_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'float_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'float_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'int32_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'int32_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'int32_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'enum_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'enum_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'enum_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'enum_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'object_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_required_nested_2_layers', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'object_optional_nested_1_layer', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'double_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - } - ] - } - } - ] - } - }, - { - 'name': 'object_readonly_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_readonly_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_readonly_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_readonly_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - } - ] - } - } - ] - } - } - }, - { - 'name': 'onDirectEventDefinedInlineOptionalKey', - 'optional': true, - 'bubblingType': 'direct', - 'typeAnnotation': { - 'type': 'EventTypeAnnotation', - 'argument': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'boolean_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'boolean_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'boolean_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'string_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'string_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'string_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'double_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'double_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'double_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'double_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'float_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'float_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'float_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'int32_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'int32_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'int32_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'enum_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'enum_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'enum_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'enum_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'object_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_required_nested_2_layers', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'object_optional_nested_1_layer', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'double_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - } - ] - } - } - ] - } - }, - { - 'name': 'object_readonly_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_readonly_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_readonly_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_readonly_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - } - ] - } - } - ] - } - } - }, - { - 'name': 'onDirectEventDefinedInlineOptionalValue', - 'optional': true, - 'bubblingType': 'direct', - 'typeAnnotation': { - 'type': 'EventTypeAnnotation', - 'argument': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'boolean_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'boolean_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'boolean_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'string_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'string_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'string_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'double_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'double_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'double_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'double_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'float_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'float_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'float_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'int32_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'int32_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'int32_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'enum_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'enum_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'enum_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'enum_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'object_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_required_nested_2_layers', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'object_optional_nested_1_layer', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'double_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - } - ] - } - } - ] - } - }, - { - 'name': 'object_readonly_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_readonly_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_readonly_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_readonly_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - } - ] - } - } - ] - } - } - }, - { - 'name': 'onDirectEventDefinedInlineOptionalBoth', - 'optional': true, - 'bubblingType': 'direct', - 'typeAnnotation': { - 'type': 'EventTypeAnnotation', - 'argument': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'boolean_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'boolean_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'boolean_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - }, - { - 'name': 'string_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'string_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'string_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'double_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'double_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'double_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'double_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'float_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'float_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'float_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'int32_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'int32_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'int32_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'enum_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'enum_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'enum_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'enum_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'object_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_required_nested_2_layers', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'object_optional_nested_1_layer', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'double_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - } - ] - } - } - ] - } - }, - { - 'name': 'object_readonly_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_readonly_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_readonly_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_readonly_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - } - ] - } - } - ] - } - } - }, - { - 'name': 'onDirectEventDefinedInlineWithPaperName', - 'optional': true, - 'bubblingType': 'direct', - 'paperTopLevelNameDeprecated': 'paperDirectEventDefinedInlineWithPaperName', + 'bubblingType': 'bubble', + 'paperTopLevelNameDeprecated': 'paperBubblingEventDefinedInlineWithPaperName', 'typeAnnotation': { 'type': 'EventTypeAnnotation', 'argument': { @@ -7631,9 +2790,9 @@ exports[`RN Codegen TypeScript Parser can generate fixture EVENTS_DEFINED_INLINE } }, { - 'name': 'onBubblingEventDefinedInline', + 'name': 'onDirectEventDefinedInline', 'optional': false, - 'bubblingType': 'bubble', + 'bubblingType': 'direct', 'typeAnnotation': { 'type': 'EventTypeAnnotation', 'argument': { @@ -8009,9 +3168,10 @@ exports[`RN Codegen TypeScript Parser can generate fixture EVENTS_DEFINED_INLINE } }, { - 'name': 'onBubblingEventDefinedInlineOptionalKey', - 'optional': true, - 'bubblingType': 'bubble', + 'name': 'onDirectEventDefinedInlineWithPaperName', + 'optional': false, + 'bubblingType': 'direct', + 'paperTopLevelNameDeprecated': 'paperDirectEventDefinedInlineWithPaperName', 'typeAnnotation': { 'type': 'EventTypeAnnotation', 'argument': { @@ -8385,11 +3545,254 @@ exports[`RN Codegen TypeScript Parser can generate fixture EVENTS_DEFINED_INLINE ] } } + } + ], + 'props': [], + 'commands': [ + { + 'name': 'scrollTo', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'params': [ + { + 'name': 'y', + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'animated', + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ], + 'returnTypeAnnotation': { + 'type': 'VoidTypeAnnotation' + } + } + } + ] + } + } + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture COMMANDS_WITH_EXTERNAL_TYPES 1`] = ` +"{ + 'modules': { + 'Module': { + 'type': 'Component', + 'components': { + 'Module': { + 'extendsProps': [ + { + 'type': 'ReactNativeBuiltInType', + 'knownTypeName': 'ReactNativeCoreViewProps' + } + ], + 'events': [], + 'props': [], + 'commands': [ + { + 'name': 'scrollTo', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'params': [ + { + 'name': 'y', + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'animated', + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ], + 'returnTypeAnnotation': { + 'type': 'VoidTypeAnnotation' + } + } + } + ] + } + } + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture EVENTS_DEFINED_AS_NULL_INLINE 1`] = ` +"{ + 'modules': { + 'Module': { + 'type': 'Component', + 'components': { + 'Module': { + 'extendsProps': [ + { + 'type': 'ReactNativeBuiltInType', + 'knownTypeName': 'ReactNativeCoreViewProps' + } + ], + 'events': [ + { + 'name': 'onDirectEventDefinedInlineNull', + 'optional': false, + 'bubblingType': 'direct', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [] + } + } + }, + { + 'name': 'onDirectEventDefinedInlineNullOptionalKey', + 'optional': true, + 'bubblingType': 'direct', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [] + } + } + }, + { + 'name': 'onDirectEventDefinedInlineNullOptionalValue', + 'optional': true, + 'bubblingType': 'direct', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [] + } + } + }, + { + 'name': 'onDirectEventDefinedInlineNullOptionalBoth', + 'optional': true, + 'bubblingType': 'direct', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [] + } + } + }, + { + 'name': 'onDirectEventDefinedInlineNullWithPaperName', + 'optional': true, + 'bubblingType': 'direct', + 'paperTopLevelNameDeprecated': 'paperDirectEventDefinedInlineNullWithPaperName', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [] + } + } + }, + { + 'name': 'onBubblingEventDefinedInlineNull', + 'optional': false, + 'bubblingType': 'bubble', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [] + } + } + }, + { + 'name': 'onBubblingEventDefinedInlineNullOptionalKey', + 'optional': true, + 'bubblingType': 'bubble', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [] + } + } + }, + { + 'name': 'onBubblingEventDefinedInlineNullOptionalValue', + 'optional': true, + 'bubblingType': 'bubble', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [] + } + } + }, + { + 'name': 'onBubblingEventDefinedInlineNullOptionalBoth', + 'optional': true, + 'bubblingType': 'bubble', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [] + } + } }, { - 'name': 'onBubblingEventDefinedInlineOptionalValue', + 'name': 'onBubblingEventDefinedInlineNullWithPaperName', 'optional': true, 'bubblingType': 'bubble', + 'paperTopLevelNameDeprecated': 'paperBubblingEventDefinedInlineNullWithPaperName', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [] + } + } + } + ], + 'props': [], + 'commands': [] + } + } + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture EVENTS_DEFINED_INLINE_WITH_ALL_TYPES 1`] = ` +"{ + 'modules': { + 'Module': { + 'type': 'Component', + 'components': { + 'Module': { + 'extendsProps': [ + { + 'type': 'ReactNativeBuiltInType', + 'knownTypeName': 'ReactNativeCoreViewProps' + } + ], + 'events': [ + { + 'name': 'onDirectEventDefinedInline', + 'optional': false, + 'bubblingType': 'direct', 'typeAnnotation': { 'type': 'EventTypeAnnotation', 'argument': { @@ -8765,9 +4168,9 @@ exports[`RN Codegen TypeScript Parser can generate fixture EVENTS_DEFINED_INLINE } }, { - 'name': 'onBubblingEventDefinedInlineOptionalBoth', + 'name': 'onDirectEventDefinedInlineOptionalKey', 'optional': true, - 'bubblingType': 'bubble', + 'bubblingType': 'direct', 'typeAnnotation': { 'type': 'EventTypeAnnotation', 'argument': { @@ -9143,10 +4546,9 @@ exports[`RN Codegen TypeScript Parser can generate fixture EVENTS_DEFINED_INLINE } }, { - 'name': 'onBubblingEventDefinedInlineWithPaperName', + 'name': 'onDirectEventDefinedInlineOptionalValue', 'optional': true, - 'bubblingType': 'bubble', - 'paperTopLevelNameDeprecated': 'paperBubblingEventDefinedInlineWithPaperName', + 'bubblingType': 'direct', 'typeAnnotation': { 'type': 'EventTypeAnnotation', 'argument': { @@ -9297,918 +4699,2880 @@ exports[`RN Codegen TypeScript Parser can generate fixture EVENTS_DEFINED_INLINE 'optional': false, 'typeAnnotation': { 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'enum_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'enum_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'enum_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringEnumTypeAnnotation', - 'options': [ - 'small', - 'large' - ] - } - }, - { - 'name': 'object_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_required_nested_2_layers', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'object_optional_nested_1_layer', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - }, - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - }, - { - 'name': 'double_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation' - } - }, - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - }, - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - } - ] - } - } - ] - } - }, - { - 'name': 'object_readonly_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_readonly_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'string_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation' - } - } - ] - } - }, - { - 'name': 'object_readonly_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'float_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation' - } - } + 'options': [ + 'small', + 'large' ] } }, { - 'name': 'object_readonly_optional_both', + 'name': 'enum_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_value', 'optional': true, 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'int32_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation' - } - } - ] - } - } - ] - } - } - } - ], - 'props': [], - 'commands': [] - } - } - } - } -}" -`; - -exports[`RN Codegen TypeScript Parser can generate fixture NO_PROPS_EVENTS_ONLY_DEPRECATED_VIEW_CONFIG_NAME_OPTION 1`] = ` -"{ - 'modules': { - 'Module': { - 'type': 'Component', - 'components': { - 'Module': { - 'deprecatedViewConfigName': 'DeprecateModuleName', - 'extendsProps': [ - { - 'type': 'ReactNativeBuiltInType', - 'knownTypeName': 'ReactNativeCoreViewProps' - } - ], - 'events': [], - 'props': [], - 'commands': [] - } - } - } - } -}" -`; - -exports[`RN Codegen TypeScript Parser can generate fixture OBJECT_PROP_TYPES_NO_EVENTS 1`] = ` -"{ - 'modules': { - 'Module': { - 'type': 'Component', - 'components': { - 'Module': { - 'extendsProps': [ - { - 'type': 'ReactNativeBuiltInType', - 'knownTypeName': 'ReactNativeCoreViewProps' - } - ], - 'events': [], - 'props': [ - { - 'name': 'boolean_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation', - 'default': false - } - } - ] - } - }, - { - 'name': 'boolean_optional', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'BooleanTypeAnnotation', - 'default': false - } - } - ] - } - }, - { - 'name': 'string_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null - } - } - ] - } - }, - { - 'name': 'string_optional', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': '' - } - } - ] - } - }, - { - 'name': 'double_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation', - 'default': 0 - } - } - ] - } - }, - { - 'name': 'double_optional', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation', - 'default': 0 - } - } - ] - } - }, - { - 'name': 'float_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation', - 'default': 0 - } - } - ] - } - }, - { - 'name': 'float_optional', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation', - 'default': 0 - } - } - ] - } - }, - { - 'name': 'int_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation', - 'default': 0 - } - } - ] - } - }, - { - 'name': 'int_optional', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation', - 'default': 0 - } - } - ] - } - }, - { - 'name': 'enum_optional', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'ArrayTypeAnnotation', - 'elementType': { 'type': 'StringEnumTypeAnnotation', - 'default': 'small', 'options': [ 'small', 'large' ] } + }, + { + 'name': 'enum_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_required_nested_2_layers', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'object_optional_nested_1_layer', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + }, + { + 'name': 'object_readonly_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } } - } - ] - } - }, - { - 'name': 'image_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' - } - } - ] - } - }, - { - 'name': 'image_optional_key', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' - } - } - ] - } - }, - { - 'name': 'image_optional_value', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' - } - } - ] - } - }, - { - 'name': 'image_optional_both', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' - } - } - ] - } - }, - { - 'name': 'color_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - ] - } - }, - { - 'name': 'color_optional_key', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - ] - } - }, - { - 'name': 'color_optional_value', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - ] - } - }, - { - 'name': 'color_optional_both', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - ] - } - }, - { - 'name': 'processed_color_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - ] - } - }, - { - 'name': 'processed_color_optional_key', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - ] - } - }, - { - 'name': 'processed_color_optional_value', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - ] - } - }, - { - 'name': 'processed_color_optional_both', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ColorPrimitive' - } - } - ] - } - }, - { - 'name': 'point_required', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' - } - } - ] - } - }, - { - 'name': 'point_optional_key', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' - } - } - ] + ] + } } }, { - 'name': 'point_optional_value', - 'optional': false, + 'name': 'onDirectEventDefinedInlineOptionalBoth', + 'optional': true, + 'bubblingType': 'direct', 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'string_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'enum_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_required_nested_2_layers', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'object_optional_nested_1_layer', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + }, + { + 'name': 'object_readonly_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } } - } - ] + ] + } } }, { - 'name': 'point_optional_both', - 'optional': false, + 'name': 'onDirectEventDefinedInlineWithPaperName', + 'optional': true, + 'bubblingType': 'direct', + 'paperTopLevelNameDeprecated': 'paperDirectEventDefinedInlineWithPaperName', 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'PointPrimitive' + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'string_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'enum_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_required_nested_2_layers', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'object_optional_nested_1_layer', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + }, + { + 'name': 'object_readonly_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } } - } - ] + ] + } } }, { - 'name': 'insets_required', + 'name': 'onBubblingEventDefinedInline', 'optional': false, + 'bubblingType': 'bubble', 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'string_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'enum_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_required_nested_2_layers', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'object_optional_nested_1_layer', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + }, + { + 'name': 'object_readonly_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } } - } - ] + ] + } } }, { - 'name': 'insets_optional_key', - 'optional': false, + 'name': 'onBubblingEventDefinedInlineOptionalKey', + 'optional': true, + 'bubblingType': 'bubble', 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'string_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'enum_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_required_nested_2_layers', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'object_optional_nested_1_layer', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + }, + { + 'name': 'object_readonly_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } } - } - ] + ] + } } }, { - 'name': 'insets_optional_value', - 'optional': false, + 'name': 'onBubblingEventDefinedInlineOptionalValue', + 'optional': true, + 'bubblingType': 'bubble', 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'string_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'enum_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_required_nested_2_layers', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'object_optional_nested_1_layer', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + }, + { + 'name': 'object_readonly_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } } - } - ] + ] + } } }, { - 'name': 'insets_optional_both', - 'optional': false, + 'name': 'onBubblingEventDefinedInlineOptionalBoth', + 'optional': true, + 'bubblingType': 'bubble', 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': true, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'EdgeInsetsPrimitive' + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'string_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'enum_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_required_nested_2_layers', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'object_optional_nested_1_layer', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + }, + { + 'name': 'object_readonly_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } } - } - ] + ] + } } }, { - 'name': 'object_required', - 'optional': false, + 'name': 'onBubblingEventDefinedInlineWithPaperName', + 'optional': true, + 'bubblingType': 'bubble', + 'paperTopLevelNameDeprecated': 'paperBubblingEventDefinedInlineWithPaperName', 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'nestedProp', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'string_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'enum_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_required_nested_2_layers', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'object_optional_nested_1_layer', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } } - } - ] - } - } - ] - } - }, - { - 'name': 'object_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'nestedProp', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null + ] + } + }, + { + 'name': 'object_readonly_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } } - } - ] - } - } - ] - } - }, - { - 'name': 'object_optional_value', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'nestedProp', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null + ] + } + }, + { + 'name': 'object_readonly_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } } - } - ] - } - } - ] - } - }, - { - 'name': 'object_optional_both', - 'optional': true, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'prop', - 'optional': false, - 'typeAnnotation': { - 'type': 'ObjectTypeAnnotation', - 'properties': [ - { - 'name': 'nestedProp', - 'optional': false, - 'typeAnnotation': { - 'type': 'StringTypeAnnotation', - 'default': null + ] + } + }, + { + 'name': 'object_readonly_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } } - } - ] + ] + } + }, + { + 'name': 'object_readonly_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } } - } - ] + ] + } } } ], + 'props': [], 'commands': [] } } @@ -10217,13 +7581,14 @@ exports[`RN Codegen TypeScript Parser can generate fixture OBJECT_PROP_TYPES_NO_ }" `; -exports[`RN Codegen TypeScript Parser can generate fixture OBJECT_STATE_TYPES 1`] = ` +exports[`RN Codegen TypeScript Parser can generate fixture NO_PROPS_EVENTS_ONLY_DEPRECATED_VIEW_CONFIG_NAME_OPTION 1`] = ` "{ 'modules': { 'Module': { 'type': 'Component', 'components': { 'Module': { + 'deprecatedViewConfigName': 'DeprecateModuleName', 'extendsProps': [ { 'type': 'ReactNativeBuiltInType', @@ -10232,8 +7597,29 @@ exports[`RN Codegen TypeScript Parser can generate fixture OBJECT_STATE_TYPES 1` ], 'events': [], 'props': [], - 'commands': [], - 'state': [ + 'commands': [] + } + } + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture OBJECT_PROP_TYPES_NO_EVENTS 1`] = ` +"{ + 'modules': { + 'Module': { + 'type': 'Component', + 'components': { + 'Module': { + 'extendsProps': [ + { + 'type': 'ReactNativeBuiltInType', + 'knownTypeName': 'ReactNativeCoreViewProps' + } + ], + 'events': [], + 'props': [ { 'name': 'boolean_required', 'optional': false, @@ -10872,7 +8258,8 @@ exports[`RN Codegen TypeScript Parser can generate fixture OBJECT_STATE_TYPES 1` ] } } - ] + ], + 'commands': [] } } } @@ -13003,102 +10390,3 @@ exports[`RN Codegen TypeScript Parser can generate fixture PROPS_AS_EXTERNAL_TYP } }" `; - -exports[`RN Codegen TypeScript Parser can generate fixture STATE_NEGATIVE_DEFAULTS 1`] = ` -"{ - 'modules': { - 'Module': { - 'type': 'Component', - 'components': { - 'Module': { - 'extendsProps': [ - { - 'type': 'ReactNativeBuiltInType', - 'knownTypeName': 'ReactNativeCoreViewProps' - } - ], - 'events': [], - 'props': [], - 'commands': [], - 'state': [ - { - 'name': 'negative_float_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'FloatTypeAnnotation', - 'default': -1 - } - }, - { - 'name': 'negative_int_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'Int32TypeAnnotation', - 'default': -1 - } - }, - { - 'name': 'negative_double_optional_key', - 'optional': true, - 'typeAnnotation': { - 'type': 'DoubleTypeAnnotation', - 'default': -1 - } - } - ] - } - } - } - } -}" -`; - -exports[`RN Codegen TypeScript Parser can generate fixture STATE_WITH_IMAGES 1`] = ` -"{ - 'modules': { - 'Module': { - 'type': 'Component', - 'components': { - 'Module': { - 'extendsProps': [ - { - 'type': 'ReactNativeBuiltInType', - 'knownTypeName': 'ReactNativeCoreViewProps' - } - ], - 'events': [], - 'props': [ - { - 'name': 'imageSource', - 'optional': false, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' - } - } - ], - 'commands': [], - 'state': [ - { - 'name': 'imageSource', - 'optional': false, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageSourcePrimitive' - } - }, - { - 'name': 'imageRequest', - 'optional': false, - 'typeAnnotation': { - 'type': 'ReservedPropTypeAnnotation', - 'name': 'ImageRequestPrimitive' - } - } - ] - } - } - } - } -}" -`; diff --git a/packages/react-native-codegen/src/parsers/typescript/components/index.js b/packages/react-native-codegen/src/parsers/typescript/components/index.js index 060063453ca64e..0c4cc4d7c29382 100644 --- a/packages/react-native-codegen/src/parsers/typescript/components/index.js +++ b/packages/react-native-codegen/src/parsers/typescript/components/index.js @@ -16,7 +16,6 @@ import type {ComponentSchemaBuilderConfig} from './schema.js'; const {getTypes} = require('../utils'); const {getCommands} = require('./commands'); const {getEvents} = require('./events'); -const {getState} = require('./states'); const {getExtendsProps, removeKnownExtends} = require('./extends'); const {getCommandOptions, getOptions} = require('./options'); const {getProps} = require('./props'); @@ -113,33 +112,8 @@ function findComponentConfig(ast) { throw new Error('codegenNativeCommands may only be called once in a file'); } - const unexportedStateTypes: Array = ast.body - .filter( - node => - node.type === 'TSInterfaceDeclaration' && - node.id.name.indexOf('NativeState') >= 0, - ) - .map(node => node.id.name); - - const exportedStateTypes: Array = namedExports - .filter( - node => - node.declaration.id && - node.declaration.id.name.indexOf('NativeState') >= 0, - ) - .map(node => node.declaration.id.name); - - const stateTypeName = exportedStateTypes.concat(unexportedStateTypes); - - if (Array.isArray(stateTypeName) && stateTypeName.length > 1) { - throw new Error( - `Found ${stateTypeName.length} NativeStates for ${foundConfig.componentName}. Each component can have only 1 NativeState`, - ); - } - return { ...foundConfig, - stateTypeName: stateTypeName.length === 1 ? stateTypeName[0] : '', commandTypeName: commandsTypeNames[0] == null ? null @@ -213,7 +187,6 @@ function buildComponentSchema(ast): ComponentSchemaBuilderConfig { const { componentName, propsTypeName, - stateTypeName, commandTypeName, commandOptionsExpression, optionsExpression, @@ -238,7 +211,7 @@ function buildComponentSchema(ast): ComponentSchemaBuilderConfig { const events = getEvents(propProperties, types); const commands = getCommands(commandProperties, types); - const toRet = { + return { filename: componentName, componentName, options, @@ -247,17 +220,6 @@ function buildComponentSchema(ast): ComponentSchemaBuilderConfig { props, commands, }; - - if (stateTypeName) { - const stateProperties = getProperties(stateTypeName, types); - const state = getState(stateProperties, types); - return { - ...toRet, - state, - }; - } - - return toRet; } module.exports = { diff --git a/packages/react-native-codegen/src/parsers/typescript/components/schema.js b/packages/react-native-codegen/src/parsers/typescript/components/schema.js index e7bff107dbeba4..ed6223c3347b50 100644 --- a/packages/react-native-codegen/src/parsers/typescript/components/schema.js +++ b/packages/react-native-codegen/src/parsers/typescript/components/schema.js @@ -15,7 +15,6 @@ import type { NamedShape, CommandTypeAnnotation, PropTypeAnnotation, - StateTypeAnnotation, ExtendsPropsShape, SchemaType, OptionsShape, @@ -28,7 +27,6 @@ export type ComponentSchemaBuilderConfig = $ReadOnly<{ events: $ReadOnlyArray, props: $ReadOnlyArray>, commands: $ReadOnlyArray>, - state?: $ReadOnlyArray>, options?: ?OptionsShape, }>; @@ -38,7 +36,6 @@ function wrapComponentSchema({ extendsProps, events, props, - state, options, commands, }: ComponentSchemaBuilderConfig): SchemaType { @@ -53,7 +50,6 @@ function wrapComponentSchema({ events, props, commands, - state, }, }, }, diff --git a/packages/react-native-codegen/src/parsers/typescript/components/states.js b/packages/react-native-codegen/src/parsers/typescript/components/states.js deleted file mode 100644 index 739548ceade831..00000000000000 --- a/packages/react-native-codegen/src/parsers/typescript/components/states.js +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict-local - * @format - */ - -'use strict'; -const { - flattenProperties, - getSchemaInfo, - getTypeAnnotation, -} = require('./componentsUtils.js'); - -import type {StateTypeAnnotation, NamedShape} from '../../../CodegenSchema.js'; -import type {TypeDeclarationMap} from '../../utils'; - -// $FlowFixMe[unclear-type] there's no flowtype for ASTs -type PropAST = Object; - -function buildStateSchema( - property: PropAST, - types: TypeDeclarationMap, -): ?NamedShape { - const info = getSchemaInfo(property, types); - if (info == null) { - return null; - } - const {name, optional, typeAnnotation, defaultValue} = info; - return { - name, - optional, - typeAnnotation: getTypeAnnotation( - name, - typeAnnotation, - defaultValue, - types, - buildStateSchema, - ), - }; -} - -function getState( - typeDefinition: $ReadOnlyArray, - types: TypeDeclarationMap, -): $ReadOnlyArray> { - return flattenProperties(typeDefinition, types) - .map(property => buildStateSchema(property, types)) - .filter(Boolean); -} - -module.exports = { - getState, -};