Skip to content

Commit 685a25c

Browse files
elicwhitefacebook-github-bot
authored andcommitted
Add recursive imports for Array types
Summary: Supporting the native primitives fixture added in the previous diff Reviewed By: JoshuaGross Differential Revision: D16846289 fbshipit-source-id: 4c6afdabba0fe4b55990d25adec21cf65d8beff3
1 parent 6ee5679 commit 685a25c

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

packages/react-native-codegen/src/generators/components/GeneratePropsH.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,16 @@ function getLocalImports(
494494
addImportsForNativeName(typeAnnotation.elementType.name);
495495
}
496496

497+
if (
498+
typeAnnotation.type === 'ArrayTypeAnnotation' &&
499+
typeAnnotation.elementType.type === 'ObjectTypeAnnotation'
500+
) {
501+
const localImports = getLocalImports(
502+
typeAnnotation.elementType.properties,
503+
);
504+
localImports.forEach(imports.add, imports);
505+
}
506+
497507
if (typeAnnotation.type === 'ObjectTypeAnnotation') {
498508
imports.add('#include <react/core/propsConversions.h>');
499509
const objectImports = getImports(typeAnnotation.properties);

packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsH-test.js.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ Map {
138138
#pragma once
139139
140140
#include <react/components/view/ViewProps.h>
141+
#include <react/graphics/Color.h>
142+
#include <react/graphics/Geometry.h>
143+
#include <react/imagemanager/primitives.h>
141144
#include <vector>
142145
143146
namespace facebook {

0 commit comments

Comments
 (0)