From 1b2bcb180c87a02630f0c346ac88be5acfb552ef Mon Sep 17 00:00:00 2001 From: Tim Yung Date: Thu, 23 Apr 2020 12:38:35 -0700 Subject: [PATCH] RN: Rename `{NativePrimitive => ReservedProp}TypeAnnotation` in Codegen Summary: Straightforward rename to clarify the purpose of this type. The current naming made more sense before the codegen also produced code for NativeModules. Changelog: [Internal] Reviewed By: TheSavior Differential Revision: D21160793 fbshipit-source-id: 6787ef298e32ff1b4d506afd831af96764f5af6f --- .../react-native-codegen/src/CodegenSchema.js | 4 +- .../src/generators/components/CppHelpers.js | 6 +- .../generators/components/GeneratePropsH.js | 14 +-- .../components/GeneratePropsJavaDelegate.js | 4 +- .../components/GeneratePropsJavaInterface.js | 4 +- .../generators/components/GenerateTests.js | 2 +- .../components/GenerateViewConfigJs.js | 4 +- .../src/generators/components/JavaHelpers.js | 6 +- .../components/__test_fixtures__/fixtures.js | 34 ++--- .../component-parser-test.js.snap | 118 +++++++++--------- .../src/parsers/flow/components/props.js | 18 +-- 11 files changed, 105 insertions(+), 109 deletions(-) diff --git a/packages/react-native-codegen/src/CodegenSchema.js b/packages/react-native-codegen/src/CodegenSchema.js index f11dbb26e56..6a8e7725ab2 100644 --- a/packages/react-native-codegen/src/CodegenSchema.js +++ b/packages/react-native-codegen/src/CodegenSchema.js @@ -124,7 +124,7 @@ type PropTypeTypeAnnotation = |}>, |}> | $ReadOnly<{| - type: 'NativePrimitiveTypeAnnotation', + type: 'ReservedPropTypeAnnotation', name: | 'ColorPrimitive' | 'ImageSourcePrimitive' @@ -165,7 +165,7 @@ type PropTypeTypeAnnotation = properties: $ReadOnlyArray, |}> | $ReadOnly<{| - type: 'NativePrimitiveTypeAnnotation', + type: 'ReservedPropTypeAnnotation', name: | 'ColorPrimitive' | 'ImageSourcePrimitive' diff --git a/packages/react-native-codegen/src/generators/components/CppHelpers.js b/packages/react-native-codegen/src/generators/components/CppHelpers.js index 0ea941489be..75b259ab84f 100644 --- a/packages/react-native-codegen/src/generators/components/CppHelpers.js +++ b/packages/react-native-codegen/src/generators/components/CppHelpers.js @@ -78,13 +78,13 @@ function getImports(properties: $ReadOnlyArray): Set { properties.forEach(prop => { const typeAnnotation = prop.typeAnnotation; - if (typeAnnotation.type === 'NativePrimitiveTypeAnnotation') { + if (typeAnnotation.type === 'ReservedPropTypeAnnotation') { addImportsForNativeName(typeAnnotation.name); } if ( typeAnnotation.type === 'ArrayTypeAnnotation' && - typeAnnotation.elementType.type === 'NativePrimitiveTypeAnnotation' + typeAnnotation.elementType.type === 'ReservedPropTypeAnnotation' ) { addImportsForNativeName(typeAnnotation.elementType.name); } @@ -151,7 +151,7 @@ function convertDefaultTypeToString( return parseInt(defaultFloatVal, 10) === defaultFloatVal ? defaultFloatVal.toFixed(1) : String(typeAnnotation.default); - case 'NativePrimitiveTypeAnnotation': + case 'ReservedPropTypeAnnotation': switch (typeAnnotation.name) { case 'ColorPrimitive': return ''; diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsH.js b/packages/react-native-codegen/src/generators/components/GeneratePropsH.js index fd12096e297..adb94d16f44 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsH.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsH.js @@ -221,7 +221,7 @@ function getNativeTypeFromAnnotation( case 'DoubleTypeAnnotation': case 'FloatTypeAnnotation': return getCppTypeForAnnotation(typeAnnotation.type); - case 'NativePrimitiveTypeAnnotation': + case 'ReservedPropTypeAnnotation': switch (typeAnnotation.name) { case 'ColorPrimitive': return 'SharedColor'; @@ -233,7 +233,7 @@ function getNativeTypeFromAnnotation( return 'EdgeInsets'; default: (typeAnnotation.name: empty); - throw new Error('Received unknown NativePrimitiveTypeAnnotation'); + throw new Error('Received unknown ReservedPropTypeAnnotation'); } case 'ArrayTypeAnnotation': { const arrayType = typeAnnotation.elementType.type; @@ -503,16 +503,14 @@ function getLocalImports( return; default: (name: empty); - throw new Error( - `Invalid NativePrimitiveTypeAnnotation name, got ${name}`, - ); + throw new Error(`Invalid ReservedPropTypeAnnotation name, got ${name}`); } } properties.forEach(prop => { const typeAnnotation = prop.typeAnnotation; - if (typeAnnotation.type === 'NativePrimitiveTypeAnnotation') { + if (typeAnnotation.type === 'ReservedPropTypeAnnotation') { addImportsForNativeName(typeAnnotation.name); } @@ -525,7 +523,7 @@ function getLocalImports( if ( typeAnnotation.type === 'ArrayTypeAnnotation' && - typeAnnotation.elementType.type === 'NativePrimitiveTypeAnnotation' + typeAnnotation.elementType.type === 'ReservedPropTypeAnnotation' ) { addImportsForNativeName(typeAnnotation.elementType.name); } @@ -703,7 +701,7 @@ function generateStruct( return; case 'FloatTypeAnnotation': return; - case 'NativePrimitiveTypeAnnotation': + case 'ReservedPropTypeAnnotation': return; case 'ArrayTypeAnnotation': return; diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaDelegate.js b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaDelegate.js index a92f7e445f1..afddadb9107 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaDelegate.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaDelegate.js @@ -97,7 +97,7 @@ function getJavaValueForProp( } else { return 'value == null ? Float.NaN : ((Double) value).floatValue()'; } - case 'NativePrimitiveTypeAnnotation': + case 'ReservedPropTypeAnnotation': switch (typeAnnotation.name) { case 'ColorPrimitive': return 'ColorPropConverter.getColor(value, view.getContext())'; @@ -109,7 +109,7 @@ function getJavaValueForProp( return '(ReadableMap) value'; default: (typeAnnotation.name: empty); - throw new Error('Received unknown NativePrimitiveTypeAnnotation'); + throw new Error('Received unknown ReservedPropTypeAnnotation'); } case 'ArrayTypeAnnotation': { return '(ReadableArray) value'; diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaInterface.js b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaInterface.js index 51b008bb54d..ea8e4262b9d 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaInterface.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaInterface.js @@ -72,7 +72,7 @@ function getJavaValueForProp(prop: PropTypeShape, imports): string { } else { return 'float value'; } - case 'NativePrimitiveTypeAnnotation': + case 'ReservedPropTypeAnnotation': switch (typeAnnotation.name) { case 'ColorPrimitive': addNullable(imports); @@ -88,7 +88,7 @@ function getJavaValueForProp(prop: PropTypeShape, imports): string { return '@Nullable ReadableMap value'; default: (typeAnnotation.name: empty); - throw new Error('Received unknown NativePrimitiveTypeAnnotation'); + throw new Error('Received unknown ReservedPropTypeAnnotation'); } case 'ArrayTypeAnnotation': { addNullable(imports); diff --git a/packages/react-native-codegen/src/generators/components/GenerateTests.js b/packages/react-native-codegen/src/generators/components/GenerateTests.js index 213ee3ba4d2..25c0cfa59a9 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateTests.js +++ b/packages/react-native-codegen/src/generators/components/GenerateTests.js @@ -83,7 +83,7 @@ function getTestCasesForProp(propName, typeAnnotation) { propName, propValue: typeAnnotation.default != null ? typeAnnotation.default : 0.1, }); - } else if (typeAnnotation.type === 'NativePrimitiveTypeAnnotation') { + } else if (typeAnnotation.type === 'ReservedPropTypeAnnotation') { if (typeAnnotation.name === 'ColorPrimitive') { cases.push({ propName, diff --git a/packages/react-native-codegen/src/generators/components/GenerateViewConfigJs.js b/packages/react-native-codegen/src/generators/components/GenerateViewConfigJs.js index 22e76aa785b..3b578b752d0 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateViewConfigJs.js +++ b/packages/react-native-codegen/src/generators/components/GenerateViewConfigJs.js @@ -49,7 +49,7 @@ function getReactDiffProcessValue(typeAnnotation) { case 'StringEnumTypeAnnotation': case 'Int32EnumTypeAnnotation': return j.literal(true); - case 'NativePrimitiveTypeAnnotation': + case 'ReservedPropTypeAnnotation': switch (typeAnnotation.name) { case 'ColorPrimitive': return j.template.expression`{ process: require('processColor') }`; @@ -67,7 +67,7 @@ function getReactDiffProcessValue(typeAnnotation) { ); } case 'ArrayTypeAnnotation': - if (typeAnnotation.elementType.type === 'NativePrimitiveTypeAnnotation') { + if (typeAnnotation.elementType.type === 'ReservedPropTypeAnnotation') { switch (typeAnnotation.elementType.name) { case 'ColorPrimitive': return j.template diff --git a/packages/react-native-codegen/src/generators/components/JavaHelpers.js b/packages/react-native-codegen/src/generators/components/JavaHelpers.js index affb28a2140..e59fe7df4f8 100644 --- a/packages/react-native-codegen/src/generators/components/JavaHelpers.js +++ b/packages/react-native-codegen/src/generators/components/JavaHelpers.js @@ -78,16 +78,14 @@ function getImports( return; default: (name: empty); - throw new Error( - `Invalid NativePrimitiveTypeAnnotation name, got ${name}`, - ); + throw new Error(`Invalid ReservedPropTypeAnnotation name, got ${name}`); } } component.props.forEach(prop => { const typeAnnotation = prop.typeAnnotation; - if (typeAnnotation.type === 'NativePrimitiveTypeAnnotation') { + if (typeAnnotation.type === 'ReservedPropTypeAnnotation') { addImportsForNativeName(typeAnnotation.name); } 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 07d7fae0e0e..9461acd92fd 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 @@ -409,7 +409,7 @@ const COLOR_PROP: SchemaType = { name: 'tintColor', optional: true, typeAnnotation: { - type: 'NativePrimitiveTypeAnnotation', + type: 'ReservedPropTypeAnnotation', name: 'ColorPrimitive', }, }, @@ -438,7 +438,7 @@ const IMAGE_PROP: SchemaType = { name: 'thumbImage', optional: true, typeAnnotation: { - type: 'NativePrimitiveTypeAnnotation', + type: 'ReservedPropTypeAnnotation', name: 'ImageSourcePrimitive', }, }, @@ -467,7 +467,7 @@ const POINT_PROP: SchemaType = { name: 'startPoint', optional: true, typeAnnotation: { - type: 'NativePrimitiveTypeAnnotation', + type: 'ReservedPropTypeAnnotation', name: 'PointPrimitive', }, }, @@ -496,7 +496,7 @@ const INSETS_PROP: SchemaType = { name: 'contentInset', optional: true, typeAnnotation: { - type: 'NativePrimitiveTypeAnnotation', + type: 'ReservedPropTypeAnnotation', name: 'EdgeInsetsPrimitive', }, }, @@ -567,7 +567,7 @@ const ARRAY_PROPS: SchemaType = { typeAnnotation: { type: 'ArrayTypeAnnotation', elementType: { - type: 'NativePrimitiveTypeAnnotation', + type: 'ReservedPropTypeAnnotation', name: 'ColorPrimitive', }, }, @@ -578,7 +578,7 @@ const ARRAY_PROPS: SchemaType = { typeAnnotation: { type: 'ArrayTypeAnnotation', elementType: { - type: 'NativePrimitiveTypeAnnotation', + type: 'ReservedPropTypeAnnotation', name: 'ImageSourcePrimitive', }, }, @@ -589,7 +589,7 @@ const ARRAY_PROPS: SchemaType = { typeAnnotation: { type: 'ArrayTypeAnnotation', elementType: { - type: 'NativePrimitiveTypeAnnotation', + type: 'ReservedPropTypeAnnotation', name: 'PointPrimitive', }, }, @@ -726,7 +726,7 @@ const ARRAY_PROPS_WITH_NESTED_OBJECT: SchemaType = { typeAnnotation: { type: 'ArrayTypeAnnotation', elementType: { - type: 'NativePrimitiveTypeAnnotation', + type: 'ReservedPropTypeAnnotation', name: 'ColorPrimitive', }, }, @@ -737,7 +737,7 @@ const ARRAY_PROPS_WITH_NESTED_OBJECT: SchemaType = { typeAnnotation: { type: 'ArrayTypeAnnotation', elementType: { - type: 'NativePrimitiveTypeAnnotation', + type: 'ReservedPropTypeAnnotation', name: 'ImageSourcePrimitive', }, }, @@ -748,7 +748,7 @@ const ARRAY_PROPS_WITH_NESTED_OBJECT: SchemaType = { typeAnnotation: { type: 'ArrayTypeAnnotation', elementType: { - type: 'NativePrimitiveTypeAnnotation', + type: 'ReservedPropTypeAnnotation', name: 'PointPrimitive', }, }, @@ -871,7 +871,7 @@ const OBJECT_PROPS: SchemaType = { name: 'image', optional: true, typeAnnotation: { - type: 'NativePrimitiveTypeAnnotation', + type: 'ReservedPropTypeAnnotation', name: 'ImageSourcePrimitive', }, }, @@ -879,7 +879,7 @@ const OBJECT_PROPS: SchemaType = { name: 'color', optional: true, typeAnnotation: { - type: 'NativePrimitiveTypeAnnotation', + type: 'ReservedPropTypeAnnotation', name: 'ColorPrimitive', }, }, @@ -887,7 +887,7 @@ const OBJECT_PROPS: SchemaType = { name: 'point', optional: true, typeAnnotation: { - type: 'NativePrimitiveTypeAnnotation', + type: 'ReservedPropTypeAnnotation', name: 'PointPrimitive', }, }, @@ -977,7 +977,7 @@ const MULTI_NATIVE_PROP: SchemaType = { name: 'thumbImage', optional: true, typeAnnotation: { - type: 'NativePrimitiveTypeAnnotation', + type: 'ReservedPropTypeAnnotation', name: 'ImageSourcePrimitive', }, }, @@ -985,7 +985,7 @@ const MULTI_NATIVE_PROP: SchemaType = { name: 'color', optional: true, typeAnnotation: { - type: 'NativePrimitiveTypeAnnotation', + type: 'ReservedPropTypeAnnotation', name: 'ColorPrimitive', }, }, @@ -993,7 +993,7 @@ const MULTI_NATIVE_PROP: SchemaType = { name: 'thumbTintColor', optional: true, typeAnnotation: { - type: 'NativePrimitiveTypeAnnotation', + type: 'ReservedPropTypeAnnotation', name: 'ColorPrimitive', }, }, @@ -1001,7 +1001,7 @@ const MULTI_NATIVE_PROP: SchemaType = { name: 'point', optional: true, typeAnnotation: { - type: 'NativePrimitiveTypeAnnotation', + type: 'ReservedPropTypeAnnotation', name: 'PointPrimitive', }, }, 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 5fdbb373abe..bd0b3629a6f 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 @@ -361,7 +361,7 @@ Object { "optional": false, "typeAnnotation": Object { "name": "ImageSourcePrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, Object { @@ -369,7 +369,7 @@ Object { "optional": true, "typeAnnotation": Object { "name": "ImageSourcePrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, Object { @@ -377,7 +377,7 @@ Object { "optional": true, "typeAnnotation": Object { "name": "ImageSourcePrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, Object { @@ -385,7 +385,7 @@ Object { "optional": false, "typeAnnotation": Object { "name": "ColorPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, Object { @@ -393,7 +393,7 @@ Object { "optional": true, "typeAnnotation": Object { "name": "ColorPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, Object { @@ -401,7 +401,7 @@ Object { "optional": true, "typeAnnotation": Object { "name": "ColorPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, Object { @@ -409,7 +409,7 @@ Object { "optional": true, "typeAnnotation": Object { "name": "ColorPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, Object { @@ -418,7 +418,7 @@ Object { "typeAnnotation": Object { "elementType": Object { "name": "ColorPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, "type": "ArrayTypeAnnotation", }, @@ -429,7 +429,7 @@ Object { "typeAnnotation": Object { "elementType": Object { "name": "ColorPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, "type": "ArrayTypeAnnotation", }, @@ -440,7 +440,7 @@ Object { "typeAnnotation": Object { "elementType": Object { "name": "ColorPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, "type": "ArrayTypeAnnotation", }, @@ -451,7 +451,7 @@ Object { "typeAnnotation": Object { "elementType": Object { "name": "ColorPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, "type": "ArrayTypeAnnotation", }, @@ -461,7 +461,7 @@ Object { "optional": false, "typeAnnotation": Object { "name": "ColorPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, Object { @@ -469,7 +469,7 @@ Object { "optional": true, "typeAnnotation": Object { "name": "ColorPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, Object { @@ -477,7 +477,7 @@ Object { "optional": true, "typeAnnotation": Object { "name": "ColorPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, Object { @@ -485,7 +485,7 @@ Object { "optional": true, "typeAnnotation": Object { "name": "ColorPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, Object { @@ -493,7 +493,7 @@ Object { "optional": false, "typeAnnotation": Object { "name": "PointPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, Object { @@ -501,7 +501,7 @@ Object { "optional": true, "typeAnnotation": Object { "name": "PointPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, Object { @@ -509,7 +509,7 @@ Object { "optional": true, "typeAnnotation": Object { "name": "PointPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, Object { @@ -517,7 +517,7 @@ Object { "optional": true, "typeAnnotation": Object { "name": "PointPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, Object { @@ -525,7 +525,7 @@ Object { "optional": false, "typeAnnotation": Object { "name": "EdgeInsetsPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, Object { @@ -533,7 +533,7 @@ Object { "optional": true, "typeAnnotation": Object { "name": "EdgeInsetsPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, Object { @@ -541,7 +541,7 @@ Object { "optional": true, "typeAnnotation": Object { "name": "EdgeInsetsPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, Object { @@ -549,7 +549,7 @@ Object { "optional": true, "typeAnnotation": Object { "name": "EdgeInsetsPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, ], @@ -819,7 +819,7 @@ Object { "typeAnnotation": Object { "elementType": Object { "name": "ImageSourcePrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, "type": "ArrayTypeAnnotation", }, @@ -830,7 +830,7 @@ Object { "typeAnnotation": Object { "elementType": Object { "name": "ImageSourcePrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, "type": "ArrayTypeAnnotation", }, @@ -841,7 +841,7 @@ Object { "typeAnnotation": Object { "elementType": Object { "name": "ImageSourcePrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, "type": "ArrayTypeAnnotation", }, @@ -852,7 +852,7 @@ Object { "typeAnnotation": Object { "elementType": Object { "name": "ImageSourcePrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, "type": "ArrayTypeAnnotation", }, @@ -863,7 +863,7 @@ Object { "typeAnnotation": Object { "elementType": Object { "name": "ColorPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, "type": "ArrayTypeAnnotation", }, @@ -874,7 +874,7 @@ Object { "typeAnnotation": Object { "elementType": Object { "name": "ColorPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, "type": "ArrayTypeAnnotation", }, @@ -885,7 +885,7 @@ Object { "typeAnnotation": Object { "elementType": Object { "name": "ColorPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, "type": "ArrayTypeAnnotation", }, @@ -896,7 +896,7 @@ Object { "typeAnnotation": Object { "elementType": Object { "name": "ColorPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, "type": "ArrayTypeAnnotation", }, @@ -907,7 +907,7 @@ Object { "typeAnnotation": Object { "elementType": Object { "name": "PointPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, "type": "ArrayTypeAnnotation", }, @@ -918,7 +918,7 @@ Object { "typeAnnotation": Object { "elementType": Object { "name": "PointPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, "type": "ArrayTypeAnnotation", }, @@ -929,7 +929,7 @@ Object { "typeAnnotation": Object { "elementType": Object { "name": "PointPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, "type": "ArrayTypeAnnotation", }, @@ -940,7 +940,7 @@ Object { "typeAnnotation": Object { "elementType": Object { "name": "PointPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, "type": "ArrayTypeAnnotation", }, @@ -951,7 +951,7 @@ Object { "typeAnnotation": Object { "elementType": Object { "name": "EdgeInsetsPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, "type": "ArrayTypeAnnotation", }, @@ -962,7 +962,7 @@ Object { "typeAnnotation": Object { "elementType": Object { "name": "EdgeInsetsPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, "type": "ArrayTypeAnnotation", }, @@ -973,7 +973,7 @@ Object { "typeAnnotation": Object { "elementType": Object { "name": "EdgeInsetsPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, "type": "ArrayTypeAnnotation", }, @@ -984,7 +984,7 @@ Object { "typeAnnotation": Object { "elementType": Object { "name": "EdgeInsetsPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, "type": "ArrayTypeAnnotation", }, @@ -5386,7 +5386,7 @@ Object { "optional": false, "typeAnnotation": Object { "name": "ImageSourcePrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, ], @@ -5403,7 +5403,7 @@ Object { "optional": true, "typeAnnotation": Object { "name": "ImageSourcePrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, ], @@ -5420,7 +5420,7 @@ Object { "optional": true, "typeAnnotation": Object { "name": "ImageSourcePrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, ], @@ -5437,7 +5437,7 @@ Object { "optional": true, "typeAnnotation": Object { "name": "ImageSourcePrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, ], @@ -5454,7 +5454,7 @@ Object { "optional": false, "typeAnnotation": Object { "name": "ColorPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, ], @@ -5471,7 +5471,7 @@ Object { "optional": true, "typeAnnotation": Object { "name": "ColorPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, ], @@ -5488,7 +5488,7 @@ Object { "optional": true, "typeAnnotation": Object { "name": "ColorPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, ], @@ -5505,7 +5505,7 @@ Object { "optional": true, "typeAnnotation": Object { "name": "ColorPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, ], @@ -5522,7 +5522,7 @@ Object { "optional": false, "typeAnnotation": Object { "name": "ColorPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, ], @@ -5539,7 +5539,7 @@ Object { "optional": true, "typeAnnotation": Object { "name": "ColorPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, ], @@ -5556,7 +5556,7 @@ Object { "optional": true, "typeAnnotation": Object { "name": "ColorPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, ], @@ -5573,7 +5573,7 @@ Object { "optional": true, "typeAnnotation": Object { "name": "ColorPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, ], @@ -5590,7 +5590,7 @@ Object { "optional": false, "typeAnnotation": Object { "name": "PointPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, ], @@ -5607,7 +5607,7 @@ Object { "optional": true, "typeAnnotation": Object { "name": "PointPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, ], @@ -5624,7 +5624,7 @@ Object { "optional": true, "typeAnnotation": Object { "name": "PointPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, ], @@ -5641,7 +5641,7 @@ Object { "optional": true, "typeAnnotation": Object { "name": "PointPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, ], @@ -5658,7 +5658,7 @@ Object { "optional": false, "typeAnnotation": Object { "name": "EdgeInsetsPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, ], @@ -5675,7 +5675,7 @@ Object { "optional": true, "typeAnnotation": Object { "name": "EdgeInsetsPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, ], @@ -5692,7 +5692,7 @@ Object { "optional": true, "typeAnnotation": Object { "name": "EdgeInsetsPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, ], @@ -5709,7 +5709,7 @@ Object { "optional": true, "typeAnnotation": Object { "name": "EdgeInsetsPrimitive", - "type": "NativePrimitiveTypeAnnotation", + "type": "ReservedPropTypeAnnotation", }, }, ], diff --git a/packages/react-native-codegen/src/parsers/flow/components/props.js b/packages/react-native-codegen/src/parsers/flow/components/props.js index 24e5889d4a3..9b549ac2337 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/props.js +++ b/packages/react-native-codegen/src/parsers/flow/components/props.js @@ -90,23 +90,23 @@ function getTypeAnnotationForArray(name, typeAnnotation, defaultValue, types) { switch (type) { case 'ImageSource': return { - type: 'NativePrimitiveTypeAnnotation', + type: 'ReservedPropTypeAnnotation', name: 'ImageSourcePrimitive', }; case 'ColorValue': case 'ProcessedColorValue': return { - type: 'NativePrimitiveTypeAnnotation', + type: 'ReservedPropTypeAnnotation', name: 'ColorPrimitive', }; case 'PointValue': return { - type: 'NativePrimitiveTypeAnnotation', + type: 'ReservedPropTypeAnnotation', name: 'PointPrimitive', }; case 'EdgeInsetsValue': return { - type: 'NativePrimitiveTypeAnnotation', + type: 'ReservedPropTypeAnnotation', name: 'EdgeInsetsPrimitive', }; case 'Stringish': @@ -214,31 +214,31 @@ function getTypeAnnotation( switch (type) { case 'ImageSource': return { - type: 'NativePrimitiveTypeAnnotation', + type: 'ReservedPropTypeAnnotation', name: 'ImageSourcePrimitive', }; case 'ColorValue': case 'ProcessedColorValue': return { - type: 'NativePrimitiveTypeAnnotation', + type: 'ReservedPropTypeAnnotation', name: 'ColorPrimitive', }; case 'ColorArrayValue': return { type: 'ArrayTypeAnnotation', elementType: { - type: 'NativePrimitiveTypeAnnotation', + type: 'ReservedPropTypeAnnotation', name: 'ColorPrimitive', }, }; case 'PointValue': return { - type: 'NativePrimitiveTypeAnnotation', + type: 'ReservedPropTypeAnnotation', name: 'PointPrimitive', }; case 'EdgeInsetsValue': return { - type: 'NativePrimitiveTypeAnnotation', + type: 'ReservedPropTypeAnnotation', name: 'EdgeInsetsPrimitive', }; case 'Int32':