diff --git a/packages/react-native-codegen/src/parsers/flow/components/componentsUtils.js b/packages/react-native-codegen/src/parsers/flow/components/componentsUtils.js index c6e72d31601..c8f2d46ec2f 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/componentsUtils.js +++ b/packages/react-native-codegen/src/parsers/flow/components/componentsUtils.js @@ -45,7 +45,10 @@ function getTypeAnnotationForArray<+T>( // Resolve the type alias if it's not defined inline const objectType = getValueFromTypes(extractedTypeAnnotation, types); - if (objectType.id.name === '$ReadOnly') { + if ( + objectType.id.name === '$ReadOnly' || + objectType.id.name === 'Readonly' + ) { return { type: 'ObjectTypeAnnotation', properties: flattenProperties( @@ -247,7 +250,8 @@ function getTypeAnnotation<+T>( if ( typeAnnotation.type === 'GenericTypeAnnotation' && - parser.getTypeAnnotationName(typeAnnotation) === '$ReadOnly' + (parser.getTypeAnnotationName(typeAnnotation) === '$ReadOnly' || + parser.getTypeAnnotationName(typeAnnotation) === 'Readonly') ) { return { type: 'ObjectTypeAnnotation', diff --git a/packages/react-native-codegen/src/parsers/flow/components/events.js b/packages/react-native-codegen/src/parsers/flow/components/events.js index 4bea22f5695..7f241cd0af6 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/events.js +++ b/packages/react-native-codegen/src/parsers/flow/components/events.js @@ -62,6 +62,7 @@ function getPropertyType( case 'Float': return emitFloatProp(name, optional); case '$ReadOnly': + case 'Readonly': return getPropertyType( name, optional, @@ -187,7 +188,7 @@ function findEventArgumentsAndType( ): EventArgumentReturnType { throwIfEventHasNoName(typeAnnotation, parser); const name = parser.getTypeAnnotationName(typeAnnotation); - if (name === '$ReadOnly') { + if (name === '$ReadOnly' || name === 'Readonly') { return { argumentProps: typeAnnotation.typeParameters.params[0].properties, paperTopLevelNameDeprecated: paperName, diff --git a/packages/react-native-codegen/src/parsers/flow/modules/index.js b/packages/react-native-codegen/src/parsers/flow/modules/index.js index 6730a7ac18b..5d946f2404b 100644 --- a/packages/react-native-codegen/src/parsers/flow/modules/index.js +++ b/packages/react-native-codegen/src/parsers/flow/modules/index.js @@ -114,7 +114,8 @@ function translateTypeAnnotation( translateTypeAnnotation, ); } - case '$ReadOnly': { + case '$ReadOnly': + case 'Readonly': { assertGenericTypeAnnotationHasExactlyOneTypeParameter( hasteModuleName, typeAnnotation,