RN: Add RootTag to New Commands Codegen

Summary:
Adds support for `RootTag` in the new codegen for Native Component Commands.

Changelog: [Internal]

Reviewed By: TheSavior

Differential Revision: D21169371

fbshipit-source-id: 3b25433f3328e9c04cfe45bb176fc06d63559f14
This commit is contained in:
Tim Yung
2020-04-23 12:38:35 -07:00
committed by Facebook GitHub Bot
parent 310b0c3af5
commit 4d9fa4b08e
12 changed files with 150 additions and 15 deletions
@@ -125,7 +125,17 @@ function generatePropsString(component: ComponentShape, imports) {
}
function getCommandArgJavaType(param) {
switch (param.typeAnnotation.type) {
const {typeAnnotation} = param;
switch (typeAnnotation.type) {
case 'ReservedFunctionValueTypeAnnotation':
switch (typeAnnotation.name) {
case 'RootTag':
return 'double';
default:
(typeAnnotation.name: empty);
throw new Error(`Receieved invalid type: ${typeAnnotation.name}`);
}
case 'BooleanTypeAnnotation':
return 'boolean';
case 'DoubleTypeAnnotation':
@@ -137,7 +147,7 @@ function getCommandArgJavaType(param) {
case 'StringTypeAnnotation':
return 'String';
default:
(param.typeAnnotation.type: empty);
(typeAnnotation.type: empty);
throw new Error('Receieved invalid typeAnnotation');
}
}