@react-native/codegen
Advanced tools
Comparing version 0.74.0-nightly-20231212-1c77919fc to 0.74.0-nightly-20231213-746ad378c
@@ -1700,2 +1700,24 @@ /** | ||
}, | ||
{ | ||
name: 'addItems', | ||
optional: false, | ||
typeAnnotation: { | ||
type: 'FunctionTypeAnnotation', | ||
params: [ | ||
{ | ||
name: 'items', | ||
optional: false, | ||
typeAnnotation: { | ||
type: 'ArrayTypeAnnotation', | ||
elementType: { | ||
type: 'StringTypeAnnotation', | ||
}, | ||
}, | ||
}, | ||
], | ||
returnTypeAnnotation: { | ||
type: 'VoidTypeAnnotation', | ||
}, | ||
}, | ||
}, | ||
], | ||
@@ -1702,0 +1724,0 @@ }, |
@@ -128,2 +128,4 @@ /** | ||
return 'NSString *'; | ||
case 'ArrayTypeAnnotation': | ||
return 'const NSArray *'; | ||
default: | ||
@@ -155,2 +157,4 @@ typeAnnotation.type; | ||
return '[NSString class]'; | ||
case 'ArrayTypeAnnotation': | ||
return '[NSArray class]'; | ||
default: | ||
@@ -182,2 +186,4 @@ typeAnnotation.type; | ||
return 'string'; | ||
case 'ArrayTypeAnnotation': | ||
return 'array'; | ||
default: | ||
@@ -209,2 +215,4 @@ typeAnnotation.type; | ||
return `(NSString *)arg${index}`; | ||
case 'ArrayTypeAnnotation': | ||
return `(NSArray *)arg${index}`; | ||
default: | ||
@@ -211,0 +219,0 @@ typeAnnotation.type; |
@@ -170,2 +170,4 @@ /** | ||
return `args.getString(${index})`; | ||
case 'ArrayTypeAnnotation': | ||
return `args.getArray(${index})`; | ||
default: | ||
@@ -172,0 +174,0 @@ typeAnnotation.type; |
@@ -148,2 +148,4 @@ /** | ||
return 'String'; | ||
case 'ArrayTypeAnnotation': | ||
return 'ReadableArray'; | ||
default: | ||
@@ -150,0 +152,0 @@ typeAnnotation.type; |
@@ -96,2 +96,10 @@ /** | ||
}); | ||
component.commands.forEach(command => { | ||
command.typeAnnotation.params.forEach(param => { | ||
const cmdParamType = param.typeAnnotation.type; | ||
if (cmdParamType === 'ArrayTypeAnnotation') { | ||
imports.add('import com.facebook.react.bridge.ReadableArray;'); | ||
} | ||
}); | ||
}); | ||
return imports; | ||
@@ -98,0 +106,0 @@ } |
@@ -75,2 +75,26 @@ /** | ||
break; | ||
case 'Array': | ||
case '$ReadOnlyArray': | ||
if (!paramValue.type === 'GenericTypeAnnotation') { | ||
throw new Error( | ||
'Array and $ReadOnlyArray are GenericTypeAnnotation for array', | ||
); | ||
} | ||
returnType = { | ||
type: 'ArrayTypeAnnotation', | ||
elementType: { | ||
// TODO: T172453752 support complex type annotation for array element | ||
type: paramValue.typeParameters.params[0].type, | ||
}, | ||
}; | ||
break; | ||
case 'ArrayTypeAnnotation': | ||
returnType = { | ||
type: 'ArrayTypeAnnotation', | ||
elementType: { | ||
// TODO: T172453752 support complex type annotation for array element | ||
type: paramValue.elementType.type, | ||
}, | ||
}; | ||
break; | ||
default: | ||
@@ -77,0 +101,0 @@ type; |
{ | ||
"name": "@react-native/codegen", | ||
"version": "0.74.0-nightly-20231212-1c77919fc", | ||
"version": "0.74.0-nightly-20231213-746ad378c", | ||
"description": "Code generation tools for React Native", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1584874
25578