mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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:
committed by
Facebook GitHub Bot
parent
310b0c3af5
commit
4d9fa4b08e
+13
-3
@@ -153,7 +153,17 @@ function generatePropCasesString(
|
||||
}
|
||||
|
||||
function getCommandArgJavaType(param, index) {
|
||||
switch (param.typeAnnotation.type) {
|
||||
const {typeAnnotation} = param;
|
||||
|
||||
switch (typeAnnotation.type) {
|
||||
case 'ReservedFunctionValueTypeAnnotation':
|
||||
switch (typeAnnotation.name) {
|
||||
case 'RootTag':
|
||||
return `args.getDouble(${index})`;
|
||||
default:
|
||||
(typeAnnotation.name: empty);
|
||||
throw new Error(`Receieved invalid type: ${typeAnnotation.name}`);
|
||||
}
|
||||
case 'BooleanTypeAnnotation':
|
||||
return `args.getBoolean(${index})`;
|
||||
case 'DoubleTypeAnnotation':
|
||||
@@ -165,8 +175,8 @@ function getCommandArgJavaType(param, index) {
|
||||
case 'StringTypeAnnotation':
|
||||
return `args.getString(${index})`;
|
||||
default:
|
||||
(param.typeAnnotation.type: empty);
|
||||
throw new Error('Receieved invalid typeAnnotation');
|
||||
(typeAnnotation.type: empty);
|
||||
throw new Error(`Receieved invalid type: ${typeAnnotation.type}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user