react-native code-gen > C++ TurboModules enum example (#36083)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36083

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D43036612

fbshipit-source-id: fc70650bc4ba48d11f489556d1290ae9e7e58016
This commit is contained in:
Christoph Purrer
2023-02-08 20:24:28 -08:00
committed by Facebook GitHub Bot
parent 2e3f55aced
commit 292a9904c4
9 changed files with 53 additions and 10 deletions
@@ -12,12 +12,10 @@ import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
import {TurboModuleRegistry} from 'react-native';
/** FIXME: Enable flow-enum support
export enum EnumInt {
A = 23,
B = 42,
}
*/
export type UnionFloat = 1.44 | 2.88 | 5.76;
export type UnionString = 'One' | 'Two' | 'Three';
@@ -45,8 +43,7 @@ export interface Spec extends TurboModule {
+getArray: (arg: Array<ObjectStruct | null>) => Array<ObjectStruct | null>;
+getBool: (arg: boolean) => boolean;
+getConstants: () => ConstantsStruct;
// FIXME: Enable flow-enum support
+getEnum: (arg: number /*EnumInt*/) => number /*EnumInt*/;
+getEnum: (arg: EnumInt) => EnumInt;
+getMap: (arg: {[key: string]: ?number}) => {[key: string]: ?number};
+getNumber: (arg: number) => number;
+getObject: (arg: ObjectStruct) => ObjectStruct;