Skip to content

Commit 9f2757c

Browse files
author
Kamil Paradowski
committed
feat: get iOS compiling
1 parent 10aab3b commit 9f2757c

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

  • packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp

‎packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeMethod.js‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ type ReturnJSType =
5151
| 'ObjectKind'
5252
| 'ArrayKind'
5353
| 'NumberKind'
54-
| 'StringKind';
54+
| 'StringKind'
55+
| 'ArrayBufferKind';
5556

5657
export type MethodSerializationOutput = Readonly<{
5758
methodName: string,
@@ -219,6 +220,9 @@ function getParamObjCType(
219220
*/
220221
return notStruct(wrapOptional('NSArray *', !nullable));
221222
}
223+
case 'ArrayBufferTypeAnnotation': {
224+
return notStruct(wrapOptional('NSMutableData *', !nullable));
225+
}
222226
}
223227

224228
const [structTypeAnnotation] = unwrapNullable(
@@ -388,9 +392,7 @@ function getReturnObjCType(
388392
case 'GenericObjectTypeAnnotation':
389393
return wrapOptional('NSDictionary *', isRequired);
390394
case 'ArrayBufferTypeAnnotation':
391-
throw new Error(
392-
`Unsupported return type for ${methodName}: ArrayBuffer is only supported for C++ TurboModules.`,
393-
);
395+
return wrapOptional('NSMutableData *', isRequired);
394396
default:
395397
typeAnnotation.type as 'MixedTypeAnnotation';
396398
throw new Error(
@@ -464,9 +466,7 @@ function getReturnJSType(
464466
throw new Error(`Unsupported union member types`);
465467
}
466468
case 'ArrayBufferTypeAnnotation':
467-
throw new Error(
468-
`Unsupported return type for ${methodName}: ArrayBuffer is only supported for C++ TurboModules.`,
469-
);
469+
return 'ArrayBufferKind';
470470
default:
471471
typeAnnotation.type as 'MixedTypeAnnotation';
472472
throw new Error(

0 commit comments

Comments
 (0)