mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Support mixed props for components
Summary: Changelog: [Changed][General] - Support mixed props for components in codegen Reviewed By: rickhanlonii Differential Revision: D43894460 fbshipit-source-id: e5faf2f83e6829170cdce550e923c3c09ddff0b0
This commit is contained in:
committed by
Facebook GitHub Bot
parent
e5b97f0f13
commit
0ae5e50e37
Vendored
+3
-1
@@ -20,6 +20,7 @@ import type {
|
||||
FloatTypeAnnotation,
|
||||
Int32TypeAnnotation,
|
||||
PropTypeAnnotation,
|
||||
MixedTypeAnnotation,
|
||||
} from '../../../CodegenSchema';
|
||||
|
||||
const {capitalize} = require('../../Utils');
|
||||
@@ -89,7 +90,8 @@ export type PojoTypeAnnotation =
|
||||
type: 'ArrayTypeAnnotation',
|
||||
elementType: PojoTypeAliasAnnotation,
|
||||
}>,
|
||||
}>;
|
||||
}>
|
||||
| MixedTypeAnnotation;
|
||||
|
||||
class PojoCollector {
|
||||
_pojos: Map<string, Pojo> = new Map();
|
||||
|
||||
Vendored
+6
@@ -24,6 +24,7 @@ function toJavaType(
|
||||
addImport('com.facebook.react.bridge.ReadableMap');
|
||||
const importArrayList = () => addImport('java.util.ArrayList');
|
||||
const importYogaValue = () => addImport('com.facebook.yoga.YogaValue');
|
||||
const importDynamic = () => addImport('com.facebook.react.bridge.Dynamic');
|
||||
switch (typeAnnotation.type) {
|
||||
/**
|
||||
* Primitives
|
||||
@@ -222,6 +223,11 @@ function toJavaType(
|
||||
return `ArrayList<${elementTypeString}>`;
|
||||
}
|
||||
|
||||
case 'MixedTypeAnnotation': {
|
||||
importDynamic();
|
||||
return 'Dynamic';
|
||||
}
|
||||
|
||||
default: {
|
||||
(typeAnnotation.type: empty);
|
||||
throw new Error(
|
||||
|
||||
Reference in New Issue
Block a user