@react-native/codegen 0.72.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -0
- package/lib/CodegenSchema.js +11 -0
- package/lib/CodegenSchema.js.flow +351 -0
- package/lib/SchemaValidator.js +54 -0
- package/lib/SchemaValidator.js.flow +67 -0
- package/lib/cli/combine/combine-js-to-schema-cli.js +50 -0
- package/lib/cli/combine/combine-js-to-schema-cli.js.flow +49 -0
- package/lib/cli/combine/combine-js-to-schema.js +110 -0
- package/lib/cli/combine/combine-js-to-schema.js.flow +48 -0
- package/lib/cli/combine/combine-utils.js +118 -0
- package/lib/cli/combine/combine-utils.js.flow +85 -0
- package/lib/cli/generators/generate-all.js +65 -0
- package/lib/cli/generators/generate-all.js.flow +66 -0
- package/lib/cli/parser/parser-cli.js +55 -0
- package/lib/cli/parser/parser-cli.js.flow +18 -0
- package/lib/cli/parser/parser.js +35 -0
- package/lib/cli/parser/parser.js.flow +37 -0
- package/lib/cli/parser/parser.sh +15 -0
- package/lib/generators/RNCodegen.js +207 -0
- package/lib/generators/RNCodegen.js.flow +284 -0
- package/lib/generators/Utils.js +31 -0
- package/lib/generators/Utils.js.flow +33 -0
- package/lib/generators/__test_fixtures__/fixtures.js +79 -0
- package/lib/generators/__test_fixtures__/fixtures.js.flow +82 -0
- package/lib/generators/components/ComponentsGeneratorUtils.js +217 -0
- package/lib/generators/components/ComponentsGeneratorUtils.js.flow +304 -0
- package/lib/generators/components/CppHelpers.js +188 -0
- package/lib/generators/components/CppHelpers.js.flow +228 -0
- package/lib/generators/components/GenerateComponentDescriptorH.js +75 -0
- package/lib/generators/components/GenerateComponentDescriptorH.js.flow +95 -0
- package/lib/generators/components/GenerateComponentHObjCpp.js +327 -0
- package/lib/generators/components/GenerateComponentHObjCpp.js.flow +418 -0
- package/lib/generators/components/GenerateEventEmitterCpp.js +199 -0
- package/lib/generators/components/GenerateEventEmitterCpp.js.flow +273 -0
- package/lib/generators/components/GenerateEventEmitterH.js +224 -0
- package/lib/generators/components/GenerateEventEmitterH.js.flow +315 -0
- package/lib/generators/components/GeneratePropsCpp.js +126 -0
- package/lib/generators/components/GeneratePropsCpp.js.flow +161 -0
- package/lib/generators/components/GeneratePropsH.js +606 -0
- package/lib/generators/components/GeneratePropsH.js.flow +778 -0
- package/lib/generators/components/GeneratePropsJavaDelegate.js +287 -0
- package/lib/generators/components/GeneratePropsJavaDelegate.js.flow +348 -0
- package/lib/generators/components/GeneratePropsJavaInterface.js +237 -0
- package/lib/generators/components/GeneratePropsJavaInterface.js.flow +288 -0
- package/lib/generators/components/GeneratePropsJavaPojo/PojoCollector.js +157 -0
- package/lib/generators/components/GeneratePropsJavaPojo/PojoCollector.js.flow +187 -0
- package/lib/generators/components/GeneratePropsJavaPojo/index.js +66 -0
- package/lib/generators/components/GeneratePropsJavaPojo/index.js.flow +80 -0
- package/lib/generators/components/GeneratePropsJavaPojo/serializePojo.js +273 -0
- package/lib/generators/components/GeneratePropsJavaPojo/serializePojo.js.flow +296 -0
- package/lib/generators/components/GenerateShadowNodeCpp.js +73 -0
- package/lib/generators/components/GenerateShadowNodeCpp.js.flow +95 -0
- package/lib/generators/components/GenerateShadowNodeH.js +91 -0
- package/lib/generators/components/GenerateShadowNodeH.js.flow +124 -0
- package/lib/generators/components/GenerateStateCpp.js +70 -0
- package/lib/generators/components/GenerateStateCpp.js.flow +92 -0
- package/lib/generators/components/GenerateStateH.js +93 -0
- package/lib/generators/components/GenerateStateH.js.flow +111 -0
- package/lib/generators/components/GenerateTests.js +165 -0
- package/lib/generators/components/GenerateTests.js.flow +219 -0
- package/lib/generators/components/GenerateThirdPartyFabricComponentsProviderH.js +91 -0
- package/lib/generators/components/GenerateThirdPartyFabricComponentsProviderH.js.flow +107 -0
- package/lib/generators/components/GenerateThirdPartyFabricComponentsProviderObjCpp.js +89 -0
- package/lib/generators/components/GenerateThirdPartyFabricComponentsProviderObjCpp.js.flow +105 -0
- package/lib/generators/components/GenerateViewConfigJs.js +410 -0
- package/lib/generators/components/GenerateViewConfigJs.js.flow +484 -0
- package/lib/generators/components/JavaHelpers.js +87 -0
- package/lib/generators/components/JavaHelpers.js.flow +119 -0
- package/lib/generators/components/__test_fixtures__/fixtures.js +1641 -0
- package/lib/generators/components/__test_fixtures__/fixtures.js.flow +1672 -0
- package/lib/generators/modules/GenerateModuleCpp.js +299 -0
- package/lib/generators/modules/GenerateModuleCpp.js.flow +278 -0
- package/lib/generators/modules/GenerateModuleH.js +373 -0
- package/lib/generators/modules/GenerateModuleH.js.flow +355 -0
- package/lib/generators/modules/GenerateModuleJavaSpec.js +571 -0
- package/lib/generators/modules/GenerateModuleJavaSpec.js.flow +553 -0
- package/lib/generators/modules/GenerateModuleJniCpp.js +505 -0
- package/lib/generators/modules/GenerateModuleJniCpp.js.flow +523 -0
- package/lib/generators/modules/GenerateModuleJniH.js +138 -0
- package/lib/generators/modules/GenerateModuleJniH.js.flow +148 -0
- package/lib/generators/modules/GenerateModuleObjCpp/StructCollector.js +262 -0
- package/lib/generators/modules/GenerateModuleObjCpp/StructCollector.js.flow +208 -0
- package/lib/generators/modules/GenerateModuleObjCpp/Utils.js +25 -0
- package/lib/generators/modules/GenerateModuleObjCpp/Utils.js.flow +32 -0
- package/lib/generators/modules/GenerateModuleObjCpp/header/serializeConstantsStruct.js +337 -0
- package/lib/generators/modules/GenerateModuleObjCpp/header/serializeConstantsStruct.js.flow +288 -0
- package/lib/generators/modules/GenerateModuleObjCpp/header/serializeRegularStruct.js +330 -0
- package/lib/generators/modules/GenerateModuleObjCpp/header/serializeRegularStruct.js.flow +279 -0
- package/lib/generators/modules/GenerateModuleObjCpp/header/serializeStruct.js +25 -0
- package/lib/generators/modules/GenerateModuleObjCpp/header/serializeStruct.js.flow +35 -0
- package/lib/generators/modules/GenerateModuleObjCpp/index.js +185 -0
- package/lib/generators/modules/GenerateModuleObjCpp/index.js.flow +219 -0
- package/lib/generators/modules/GenerateModuleObjCpp/serializeMethod.js +529 -0
- package/lib/generators/modules/GenerateModuleObjCpp/serializeMethod.js.flow +510 -0
- package/lib/generators/modules/GenerateModuleObjCpp/source/serializeModule.js +96 -0
- package/lib/generators/modules/GenerateModuleObjCpp/source/serializeModule.js.flow +121 -0
- package/lib/generators/modules/Utils.js +34 -0
- package/lib/generators/modules/Utils.js.flow +53 -0
- package/lib/generators/modules/__test_fixtures__/fixtures.js +1658 -0
- package/lib/generators/modules/__test_fixtures__/fixtures.js.flow +1669 -0
- package/lib/parsers/consistency/compareSnaps.js +84 -0
- package/lib/parsers/error-utils.js +284 -0
- package/lib/parsers/error-utils.js.flow +295 -0
- package/lib/parsers/errors.js +350 -0
- package/lib/parsers/errors.js.flow +439 -0
- package/lib/parsers/flow/components/__test_fixtures__/failures.js +583 -0
- package/lib/parsers/flow/components/__test_fixtures__/failures.js.flow +600 -0
- package/lib/parsers/flow/components/__test_fixtures__/fixtures.js +1001 -0
- package/lib/parsers/flow/components/__test_fixtures__/fixtures.js.flow +1016 -0
- package/lib/parsers/flow/components/commands.js +104 -0
- package/lib/parsers/flow/components/commands.js.flow +123 -0
- package/lib/parsers/flow/components/componentsUtils.js +446 -0
- package/lib/parsers/flow/components/componentsUtils.js.flow +496 -0
- package/lib/parsers/flow/components/events.js +233 -0
- package/lib/parsers/flow/components/events.js.flow +262 -0
- package/lib/parsers/flow/components/extends.js +52 -0
- package/lib/parsers/flow/components/extends.js.flow +66 -0
- package/lib/parsers/flow/components/index.js +267 -0
- package/lib/parsers/flow/components/index.js.flow +226 -0
- package/lib/parsers/flow/components/options.js +72 -0
- package/lib/parsers/flow/components/options.js.flow +87 -0
- package/lib/parsers/flow/components/props.js +47 -0
- package/lib/parsers/flow/components/props.js.flow +60 -0
- package/lib/parsers/flow/components/schema.js +106 -0
- package/lib/parsers/flow/components/schema.js.flow +62 -0
- package/lib/parsers/flow/index.js +80 -0
- package/lib/parsers/flow/index.js.flow +85 -0
- package/lib/parsers/flow/modules/__test_fixtures__/failures.js +215 -0
- package/lib/parsers/flow/modules/__test_fixtures__/failures.js.flow +223 -0
- package/lib/parsers/flow/modules/__test_fixtures__/fixtures.js +724 -0
- package/lib/parsers/flow/modules/__test_fixtures__/fixtures.js.flow +747 -0
- package/lib/parsers/flow/modules/index.js +528 -0
- package/lib/parsers/flow/modules/index.js.flow +420 -0
- package/lib/parsers/flow/parser.js +109 -0
- package/lib/parsers/flow/parser.js.flow +83 -0
- package/lib/parsers/flow/utils.js +108 -0
- package/lib/parsers/flow/utils.js.flow +123 -0
- package/lib/parsers/parser.js +11 -0
- package/lib/parsers/parser.js.flow +70 -0
- package/lib/parsers/parserMock.js +96 -0
- package/lib/parsers/parserMock.js.flow +68 -0
- package/lib/parsers/parsers-commons.js +448 -0
- package/lib/parsers/parsers-commons.js.flow +447 -0
- package/lib/parsers/parsers-primitives.js +387 -0
- package/lib/parsers/parsers-primitives.js.flow +383 -0
- package/lib/parsers/parsers-utils.js +18 -0
- package/lib/parsers/parsers-utils.js.flow +19 -0
- package/lib/parsers/schema/index.js +23 -0
- package/lib/parsers/schema/index.js.flow +26 -0
- package/lib/parsers/typescript/components/__test_fixtures__/failures.js +489 -0
- package/lib/parsers/typescript/components/__test_fixtures__/failures.js.flow +505 -0
- package/lib/parsers/typescript/components/__test_fixtures__/fixtures.js +1151 -0
- package/lib/parsers/typescript/components/__test_fixtures__/fixtures.js.flow +1168 -0
- package/lib/parsers/typescript/components/commands.js +132 -0
- package/lib/parsers/typescript/components/commands.js.flow +151 -0
- package/lib/parsers/typescript/components/componentsUtils.js +471 -0
- package/lib/parsers/typescript/components/componentsUtils.js.flow +521 -0
- package/lib/parsers/typescript/components/events.js +240 -0
- package/lib/parsers/typescript/components/events.js.flow +262 -0
- package/lib/parsers/typescript/components/extends.js +88 -0
- package/lib/parsers/typescript/components/extends.js.flow +103 -0
- package/lib/parsers/typescript/components/index.js +277 -0
- package/lib/parsers/typescript/components/index.js.flow +239 -0
- package/lib/parsers/typescript/components/options.js +72 -0
- package/lib/parsers/typescript/components/options.js.flow +87 -0
- package/lib/parsers/typescript/components/props.js +39 -0
- package/lib/parsers/typescript/components/props.js.flow +48 -0
- package/lib/parsers/typescript/components/schema.js +106 -0
- package/lib/parsers/typescript/components/schema.js.flow +62 -0
- package/lib/parsers/typescript/index.js +85 -0
- package/lib/parsers/typescript/index.js.flow +94 -0
- package/lib/parsers/typescript/modules/__test_fixtures__/failures.js +160 -0
- package/lib/parsers/typescript/modules/__test_fixtures__/failures.js.flow +167 -0
- package/lib/parsers/typescript/modules/__test_fixtures__/fixtures.js +701 -0
- package/lib/parsers/typescript/modules/__test_fixtures__/fixtures.js.flow +727 -0
- package/lib/parsers/typescript/modules/index.js +543 -0
- package/lib/parsers/typescript/modules/index.js.flow +435 -0
- package/lib/parsers/typescript/parseTopLevelType.js +203 -0
- package/lib/parsers/typescript/parseTopLevelType.js.flow +243 -0
- package/lib/parsers/typescript/parser.js +105 -0
- package/lib/parsers/typescript/parser.js.flow +87 -0
- package/lib/parsers/typescript/utils.js +101 -0
- package/lib/parsers/typescript/utils.js.flow +115 -0
- package/lib/parsers/utils.js +273 -0
- package/lib/parsers/utils.js.flow +266 -0
- package/package.json +45 -0
|
@@ -0,0 +1,701 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// @licenselint-loose-mode
|
|
12
|
+
|
|
13
|
+
const EMPTY_NATIVE_MODULE = `
|
|
14
|
+
/**
|
|
15
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
16
|
+
*
|
|
17
|
+
* This source code is licensed under the MIT license found in the
|
|
18
|
+
* LICENSE file in the root directory of this source tree.
|
|
19
|
+
*
|
|
20
|
+
* @format
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
|
|
24
|
+
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
|
|
25
|
+
|
|
26
|
+
export interface Spec extends TurboModule {
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
|
31
|
+
`;
|
|
32
|
+
const NATIVE_MODULE_WITH_COMPLEX_OBJECTS = `
|
|
33
|
+
/**
|
|
34
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
35
|
+
*
|
|
36
|
+
* This source code is licensed under the MIT license found in the
|
|
37
|
+
* LICENSE file in the root directory of this source tree.
|
|
38
|
+
*
|
|
39
|
+
* @format
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
|
|
43
|
+
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
|
|
44
|
+
|
|
45
|
+
export type String = string;
|
|
46
|
+
|
|
47
|
+
export interface Spec extends TurboModule {
|
|
48
|
+
// Exported methods.
|
|
49
|
+
readonly getObject: (arg: {const1: {const1: boolean}}) => {
|
|
50
|
+
const1: {const1: boolean},
|
|
51
|
+
};
|
|
52
|
+
readonly getReadOnlyObject: (arg: Readonly<{const1: Readonly<{const1: boolean}>}>) => Readonly<{
|
|
53
|
+
const1: {const1: boolean},
|
|
54
|
+
}>;
|
|
55
|
+
readonly getObject2: (arg: { a: String }) => Object;
|
|
56
|
+
readonly getObjectInArray: (arg: {const1: {const1: boolean}}) => Array<{
|
|
57
|
+
const1: {const1: boolean},
|
|
58
|
+
}>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
|
62
|
+
`;
|
|
63
|
+
const NATIVE_MODULE_WITH_COMPLEX_OBJECTS_WITH_NULLABLE_KEY = `
|
|
64
|
+
/**
|
|
65
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
66
|
+
*
|
|
67
|
+
* This source code is licensed under the MIT license found in the
|
|
68
|
+
* LICENSE file in the root directory of this source tree.
|
|
69
|
+
*
|
|
70
|
+
* @format
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
|
|
74
|
+
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
|
|
75
|
+
|
|
76
|
+
export type String = string;
|
|
77
|
+
|
|
78
|
+
export interface Spec extends TurboModule {
|
|
79
|
+
readonly getConstants: () => {
|
|
80
|
+
isTesting: boolean;
|
|
81
|
+
reactNativeVersion: {
|
|
82
|
+
major: number;
|
|
83
|
+
minor: number;
|
|
84
|
+
patch?: number;
|
|
85
|
+
prerelease: number | null | undefined;
|
|
86
|
+
};
|
|
87
|
+
forceTouchAvailable: boolean;
|
|
88
|
+
osVersion: string;
|
|
89
|
+
systemName: string;
|
|
90
|
+
interfaceIdiom: string;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
|
95
|
+
`;
|
|
96
|
+
const NATIVE_MODULE_WITH_BASIC_PARAM_TYPES = `
|
|
97
|
+
/**
|
|
98
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
99
|
+
*
|
|
100
|
+
* This source code is licensed under the MIT license found in the
|
|
101
|
+
* LICENSE file in the root directory of this source tree.
|
|
102
|
+
*
|
|
103
|
+
* @format
|
|
104
|
+
*/
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
import type {TurboModule} from '../RCTExport';
|
|
108
|
+
import * as TurboModuleRegistry from '../TurboModuleRegistry';
|
|
109
|
+
|
|
110
|
+
export interface Spec extends TurboModule {
|
|
111
|
+
readonly passBool?: (arg: boolean) => void;
|
|
112
|
+
readonly passNumber: (arg: number) => void;
|
|
113
|
+
readonly passString: (arg: string) => void;
|
|
114
|
+
readonly passStringish: (arg: Stringish) => void;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
|
118
|
+
|
|
119
|
+
`;
|
|
120
|
+
const NATIVE_MODULE_WITH_ALIASES = `
|
|
121
|
+
/**
|
|
122
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
123
|
+
*
|
|
124
|
+
* This source code is licensed under the MIT license found in the
|
|
125
|
+
* LICENSE file in the root directory of this source tree.
|
|
126
|
+
*
|
|
127
|
+
* @format
|
|
128
|
+
*/
|
|
129
|
+
|
|
130
|
+
import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
|
|
131
|
+
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
|
|
132
|
+
|
|
133
|
+
type NumNum = number;
|
|
134
|
+
export type Num = (arg: NumNum) => void;
|
|
135
|
+
type Num2 = Num;
|
|
136
|
+
export type Void = void;
|
|
137
|
+
export type A = number;
|
|
138
|
+
export type B = number;
|
|
139
|
+
export type ObjectAlias = {
|
|
140
|
+
x: number;
|
|
141
|
+
y: number;
|
|
142
|
+
label: string;
|
|
143
|
+
truthy: boolean;
|
|
144
|
+
};
|
|
145
|
+
export type ReadOnlyAlias = Readonly<ObjectAlias>;
|
|
146
|
+
|
|
147
|
+
export interface Spec extends TurboModule {
|
|
148
|
+
// Exported methods.
|
|
149
|
+
readonly getNumber: Num2;
|
|
150
|
+
readonly getVoid: () => Void;
|
|
151
|
+
readonly getArray: (a: Array<A>) => {a: B};
|
|
152
|
+
readonly getStringFromAlias: (a: ObjectAlias) => string;
|
|
153
|
+
readonly getStringFromNullableAlias: (a: ObjectAlias | null) => string;
|
|
154
|
+
readonly getStringFromReadOnlyAlias: (a: ReadOnlyAlias) => string;
|
|
155
|
+
readonly getStringFromNullableReadOnlyAlias: (a: ReadOnlyAlias | null) => string;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
|
159
|
+
`;
|
|
160
|
+
const NATIVE_MODULE_WITH_NESTED_ALIASES = `
|
|
161
|
+
/**
|
|
162
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
163
|
+
*
|
|
164
|
+
* This source code is licensed under the MIT license found in the
|
|
165
|
+
* LICENSE file in the root directory of this source tree.
|
|
166
|
+
*
|
|
167
|
+
* @format
|
|
168
|
+
*/
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
import type {TurboModule} from '../RCTExport';
|
|
172
|
+
import * as TurboModuleRegistry from '../TurboModuleRegistry';
|
|
173
|
+
|
|
174
|
+
type Bar = {
|
|
175
|
+
z: number
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
type Foo = {
|
|
179
|
+
bar1: Bar,
|
|
180
|
+
bar2: Bar,
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
export interface Spec extends TurboModule {
|
|
184
|
+
// Exported methods.
|
|
185
|
+
foo1: (x: Foo) => Foo;
|
|
186
|
+
foo2: (x: Foo) => void;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
|
190
|
+
|
|
191
|
+
`;
|
|
192
|
+
const NATIVE_MODULE_WITH_FLOAT_AND_INT32 = `
|
|
193
|
+
/**
|
|
194
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
195
|
+
*
|
|
196
|
+
* This source code is licensed under the MIT license found in the
|
|
197
|
+
* LICENSE file in the root directory of this source tree.
|
|
198
|
+
*
|
|
199
|
+
* @format
|
|
200
|
+
*/
|
|
201
|
+
|
|
202
|
+
import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
|
|
203
|
+
import type {Int32, Float} from 'react-native/Libraries/Types/CodegenTypes';
|
|
204
|
+
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
|
|
205
|
+
|
|
206
|
+
export interface Spec extends TurboModule {
|
|
207
|
+
readonly getInt: (arg: Int32) => Int32;
|
|
208
|
+
readonly getFloat: (arg: Float) => Float;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
|
212
|
+
`;
|
|
213
|
+
const NATIVE_MODULE_WITH_SIMPLE_OBJECT = `
|
|
214
|
+
/**
|
|
215
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
216
|
+
*
|
|
217
|
+
* This source code is licensed under the MIT license found in the
|
|
218
|
+
* LICENSE file in the root directory of this source tree.
|
|
219
|
+
*
|
|
220
|
+
* @format
|
|
221
|
+
*/
|
|
222
|
+
|
|
223
|
+
import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
|
|
224
|
+
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
|
|
225
|
+
|
|
226
|
+
export interface Spec extends TurboModule {
|
|
227
|
+
readonly getObject: (o: Object) => Object,
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
|
231
|
+
`;
|
|
232
|
+
const NATIVE_MODULE_WITH_UNSAFE_OBJECT = `
|
|
233
|
+
/**
|
|
234
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
235
|
+
*
|
|
236
|
+
* This source code is licensed under the MIT license found in the
|
|
237
|
+
* LICENSE file in the root directory of this source tree.
|
|
238
|
+
*
|
|
239
|
+
* @format
|
|
240
|
+
*/
|
|
241
|
+
|
|
242
|
+
import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
|
|
243
|
+
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
|
|
244
|
+
import type {UnsafeObject} from 'react-native/Libraries/Types/CodegenTypes';
|
|
245
|
+
|
|
246
|
+
export interface Spec extends TurboModule {
|
|
247
|
+
readonly getUnsafeObject: (o: UnsafeObject) => UnsafeObject;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
|
251
|
+
`;
|
|
252
|
+
const NATIVE_MODULE_WITH_ROOT_TAG = `
|
|
253
|
+
/**
|
|
254
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
255
|
+
*
|
|
256
|
+
* This source code is licensed under the MIT license found in the
|
|
257
|
+
* LICENSE file in the root directory of this source tree.
|
|
258
|
+
*
|
|
259
|
+
* @format
|
|
260
|
+
*/
|
|
261
|
+
|
|
262
|
+
import type {
|
|
263
|
+
TurboModule,
|
|
264
|
+
RootTag,
|
|
265
|
+
} from 'react-native/Libraries/TurboModule/RCTExport';
|
|
266
|
+
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
|
|
267
|
+
|
|
268
|
+
export interface Spec extends TurboModule {
|
|
269
|
+
readonly getRootTag: (rootTag: RootTag) => RootTag;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
|
273
|
+
`;
|
|
274
|
+
const NATIVE_MODULE_WITH_NULLABLE_PARAM = `
|
|
275
|
+
/**
|
|
276
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
277
|
+
*
|
|
278
|
+
* This source code is licensed under the MIT license found in the
|
|
279
|
+
* LICENSE file in the root directory of this source tree.
|
|
280
|
+
*
|
|
281
|
+
* @format
|
|
282
|
+
*/
|
|
283
|
+
|
|
284
|
+
import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
|
|
285
|
+
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
|
|
286
|
+
|
|
287
|
+
export interface Spec extends TurboModule {
|
|
288
|
+
readonly voidFunc: (arg: string | null | undefined) => void;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
|
292
|
+
`;
|
|
293
|
+
const NATIVE_MODULE_WITH_BASIC_ARRAY = `
|
|
294
|
+
/**
|
|
295
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
296
|
+
*
|
|
297
|
+
* This source code is licensed under the MIT license found in the
|
|
298
|
+
* LICENSE file in the root directory of this source tree.
|
|
299
|
+
*
|
|
300
|
+
* @format
|
|
301
|
+
*/
|
|
302
|
+
|
|
303
|
+
import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
|
|
304
|
+
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
|
|
305
|
+
|
|
306
|
+
export interface Spec extends TurboModule {
|
|
307
|
+
readonly getArray: (arg: Array<string>) => (Array<(string)>);
|
|
308
|
+
readonly getArray: (arg: ReadonlyArray<string>) => (ReadonlyArray<(string)>);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
|
312
|
+
`;
|
|
313
|
+
const NATIVE_MODULE_WITH_BASIC_ARRAY2 = `
|
|
314
|
+
/**
|
|
315
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
316
|
+
*
|
|
317
|
+
* This source code is licensed under the MIT license found in the
|
|
318
|
+
* LICENSE file in the root directory of this source tree.
|
|
319
|
+
*
|
|
320
|
+
* @format
|
|
321
|
+
*/
|
|
322
|
+
|
|
323
|
+
import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
|
|
324
|
+
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
|
|
325
|
+
|
|
326
|
+
export interface Spec extends TurboModule {
|
|
327
|
+
readonly getArray: (arg: string[]) => ((string)[]);
|
|
328
|
+
readonly getArray: (arg: readonly string[]) => (readonly (string)[]);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
|
332
|
+
`;
|
|
333
|
+
const NATIVE_MODULE_WITH_OBJECT_WITH_OBJECT_DEFINED_IN_FILE_AS_PROPERTY = `
|
|
334
|
+
/**
|
|
335
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
336
|
+
*
|
|
337
|
+
* This source code is licensed under the MIT license found in the
|
|
338
|
+
* LICENSE file in the root directory of this source tree.
|
|
339
|
+
*
|
|
340
|
+
* @format
|
|
341
|
+
*/
|
|
342
|
+
|
|
343
|
+
import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
|
|
344
|
+
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
|
|
345
|
+
|
|
346
|
+
type DisplayMetricsAndroid = {
|
|
347
|
+
width: number;
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
export interface Spec extends TurboModule {
|
|
351
|
+
readonly getConstants: () => {
|
|
352
|
+
readonly Dimensions: {
|
|
353
|
+
windowPhysicalPixels: DisplayMetricsAndroid;
|
|
354
|
+
};
|
|
355
|
+
};
|
|
356
|
+
readonly getConstants2: () => Readonly<{
|
|
357
|
+
readonly Dimensions: {
|
|
358
|
+
windowPhysicalPixels: DisplayMetricsAndroid;
|
|
359
|
+
};
|
|
360
|
+
}>;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
|
364
|
+
`;
|
|
365
|
+
const NATIVE_MODULE_WITH_ARRAY_WITH_UNION_AND_TOUPLE = `
|
|
366
|
+
/**
|
|
367
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
368
|
+
*
|
|
369
|
+
* This source code is licensed under the MIT license found in the
|
|
370
|
+
* LICENSE file in the root directory of this source tree.
|
|
371
|
+
*
|
|
372
|
+
* @format
|
|
373
|
+
*/
|
|
374
|
+
|
|
375
|
+
import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
|
|
376
|
+
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
|
|
377
|
+
|
|
378
|
+
export interface Spec extends TurboModule {
|
|
379
|
+
readonly getArray: (
|
|
380
|
+
arg: Array<[string, string]>,
|
|
381
|
+
) => Array<string | number | boolean>;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
|
385
|
+
`;
|
|
386
|
+
const NATIVE_MODULE_WITH_ARRAY2_WITH_UNION_AND_TOUPLE = `
|
|
387
|
+
/**
|
|
388
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
389
|
+
*
|
|
390
|
+
* This source code is licensed under the MIT license found in the
|
|
391
|
+
* LICENSE file in the root directory of this source tree.
|
|
392
|
+
*
|
|
393
|
+
* @format
|
|
394
|
+
*/
|
|
395
|
+
|
|
396
|
+
import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
|
|
397
|
+
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
|
|
398
|
+
|
|
399
|
+
export interface Spec extends TurboModule {
|
|
400
|
+
getArray(
|
|
401
|
+
arg: [string, string][],
|
|
402
|
+
): (string | number | boolean)[];
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
|
406
|
+
`;
|
|
407
|
+
const NATIVE_MODULE_WITH_ARRAY_WITH_ALIAS = `
|
|
408
|
+
/**
|
|
409
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
410
|
+
*
|
|
411
|
+
* This source code is licensed under the MIT license found in the
|
|
412
|
+
* LICENSE file in the root directory of this source tree.
|
|
413
|
+
*
|
|
414
|
+
* @format
|
|
415
|
+
*/
|
|
416
|
+
|
|
417
|
+
import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
|
|
418
|
+
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
|
|
419
|
+
|
|
420
|
+
export type SomeString = string;
|
|
421
|
+
|
|
422
|
+
export interface Spec extends TurboModule {
|
|
423
|
+
readonly getArray: (arg: Array<SomeString>) => Array<string>;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
|
427
|
+
`;
|
|
428
|
+
const NATIVE_MODULE_WITH_ARRAY2_WITH_ALIAS = `
|
|
429
|
+
/**
|
|
430
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
431
|
+
*
|
|
432
|
+
* This source code is licensed under the MIT license found in the
|
|
433
|
+
* LICENSE file in the root directory of this source tree.
|
|
434
|
+
*
|
|
435
|
+
* @format
|
|
436
|
+
*/
|
|
437
|
+
|
|
438
|
+
import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
|
|
439
|
+
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
|
|
440
|
+
|
|
441
|
+
export type SomeString = string;
|
|
442
|
+
|
|
443
|
+
export interface Spec extends TurboModule {
|
|
444
|
+
readonly getArray: (arg: SomeString[]) => string[];
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
|
448
|
+
`;
|
|
449
|
+
const NATIVE_MODULE_WITH_COMPLEX_ARRAY = `
|
|
450
|
+
/**
|
|
451
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
452
|
+
*
|
|
453
|
+
* This source code is licensed under the MIT license found in the
|
|
454
|
+
* LICENSE file in the root directory of this source tree.
|
|
455
|
+
*
|
|
456
|
+
* @format
|
|
457
|
+
*/
|
|
458
|
+
|
|
459
|
+
import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
|
|
460
|
+
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
|
|
461
|
+
|
|
462
|
+
export interface Spec extends TurboModule {
|
|
463
|
+
readonly getArray: (
|
|
464
|
+
arg: Array<Array<Array<Array<Array<string>>>>>,
|
|
465
|
+
) => Array<Array<Array<string>>>;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
|
469
|
+
`;
|
|
470
|
+
const NATIVE_MODULE_WITH_COMPLEX_ARRAY2 = `
|
|
471
|
+
/**
|
|
472
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
473
|
+
*
|
|
474
|
+
* This source code is licensed under the MIT license found in the
|
|
475
|
+
* LICENSE file in the root directory of this source tree.
|
|
476
|
+
*
|
|
477
|
+
* @format
|
|
478
|
+
*/
|
|
479
|
+
|
|
480
|
+
import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
|
|
481
|
+
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
|
|
482
|
+
|
|
483
|
+
export interface Spec extends TurboModule {
|
|
484
|
+
readonly getArray: (
|
|
485
|
+
arg: string[][][][][],
|
|
486
|
+
) => string[][][];
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
|
490
|
+
`;
|
|
491
|
+
const NATIVE_MODULE_WITH_PROMISE = `
|
|
492
|
+
/**
|
|
493
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
494
|
+
*
|
|
495
|
+
* This source code is licensed under the MIT license found in the
|
|
496
|
+
* LICENSE file in the root directory of this source tree.
|
|
497
|
+
*
|
|
498
|
+
* @format
|
|
499
|
+
*/
|
|
500
|
+
|
|
501
|
+
import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
|
|
502
|
+
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
|
|
503
|
+
|
|
504
|
+
export type String = string;
|
|
505
|
+
export type SomeObj = { a: string };
|
|
506
|
+
|
|
507
|
+
export interface Spec extends TurboModule {
|
|
508
|
+
readonly getValueWithPromise: () => Promise<string>;
|
|
509
|
+
readonly getValueWithPromiseDefinedSomewhereElse: () => Promise<String>;
|
|
510
|
+
readonly getValueWithPromiseObjDefinedSomewhereElse: () => Promise<SomeObj>;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
|
514
|
+
`;
|
|
515
|
+
const NATIVE_MODULE_WITH_CALLBACK = `
|
|
516
|
+
/**
|
|
517
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
518
|
+
*
|
|
519
|
+
* This source code is licensed under the MIT license found in the
|
|
520
|
+
* LICENSE file in the root directory of this source tree.
|
|
521
|
+
*
|
|
522
|
+
* @format
|
|
523
|
+
*/
|
|
524
|
+
|
|
525
|
+
import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
|
|
526
|
+
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
|
|
527
|
+
|
|
528
|
+
export interface Spec extends TurboModule {
|
|
529
|
+
readonly getValueWithCallback: (
|
|
530
|
+
callback: (value: string, arr: Array<Array<string>>) => void,
|
|
531
|
+
) => void;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
|
535
|
+
`;
|
|
536
|
+
const NATIVE_MODULE_WITH_UNION = `
|
|
537
|
+
/**
|
|
538
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
539
|
+
*
|
|
540
|
+
* This source code is licensed under the MIT license found in the
|
|
541
|
+
* LICENSE file in the root directory of this source tree.
|
|
542
|
+
*
|
|
543
|
+
* @format
|
|
544
|
+
*/
|
|
545
|
+
|
|
546
|
+
import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
|
|
547
|
+
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
|
|
548
|
+
|
|
549
|
+
export type ChooseInt = 1 | 2 | 3;
|
|
550
|
+
export type ChooseFloat = 1.44 | 2.88 | 5.76;
|
|
551
|
+
export type ChooseObject = {} | {low: string};
|
|
552
|
+
export type ChooseString = 'One' | 'Two' | 'Three';
|
|
553
|
+
|
|
554
|
+
export interface Spec extends TurboModule {
|
|
555
|
+
readonly getUnion: (chooseInt: ChooseInt, chooseFloat: ChooseFloat, chooseObject: ChooseObject, chooseString: ChooseString) => ChooseObject;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
|
559
|
+
|
|
560
|
+
`;
|
|
561
|
+
const ANDROID_ONLY_NATIVE_MODULE = `
|
|
562
|
+
/**
|
|
563
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
564
|
+
*
|
|
565
|
+
* This source code is licensed under the MIT license found in the
|
|
566
|
+
* LICENSE file in the root directory of this source tree.
|
|
567
|
+
*
|
|
568
|
+
* @format
|
|
569
|
+
*/
|
|
570
|
+
|
|
571
|
+
import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
|
|
572
|
+
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
|
|
573
|
+
|
|
574
|
+
export interface Spec extends TurboModule {}
|
|
575
|
+
|
|
576
|
+
export default TurboModuleRegistry.getEnforcing<Spec>(
|
|
577
|
+
'SampleTurboModuleAndroid',
|
|
578
|
+
);
|
|
579
|
+
`;
|
|
580
|
+
const IOS_ONLY_NATIVE_MODULE = `
|
|
581
|
+
/**
|
|
582
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
583
|
+
*
|
|
584
|
+
* This source code is licensed under the MIT license found in the
|
|
585
|
+
* LICENSE file in the root directory of this source tree.
|
|
586
|
+
*
|
|
587
|
+
* @format
|
|
588
|
+
*/
|
|
589
|
+
|
|
590
|
+
import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
|
|
591
|
+
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
|
|
592
|
+
|
|
593
|
+
export enum Quality {
|
|
594
|
+
SD,
|
|
595
|
+
HD,
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
export enum Resolution {
|
|
599
|
+
Low = 720,
|
|
600
|
+
High = 1080,
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
export enum Floppy {
|
|
604
|
+
LowDensity = 0.72,
|
|
605
|
+
HighDensity = 1.44,
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
export enum StringOptions {
|
|
609
|
+
One = 'one',
|
|
610
|
+
Two = 'two',
|
|
611
|
+
Three = 'three',
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
export interface Spec extends TurboModule {
|
|
615
|
+
readonly getEnums: (quality: Quality, resolution?: Resolution, floppy: Floppy, stringOptions: StringOptions) => string;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
export default TurboModuleRegistry.getEnforcing<Spec>(
|
|
619
|
+
'SampleTurboModuleIOS',
|
|
620
|
+
);
|
|
621
|
+
`;
|
|
622
|
+
const CXX_ONLY_NATIVE_MODULE = `
|
|
623
|
+
/**
|
|
624
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
625
|
+
*
|
|
626
|
+
* This source code is licensed under the MIT license found in the
|
|
627
|
+
* LICENSE file in the root directory of this source tree.
|
|
628
|
+
*
|
|
629
|
+
* @format
|
|
630
|
+
*/
|
|
631
|
+
|
|
632
|
+
import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
|
|
633
|
+
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
|
|
634
|
+
|
|
635
|
+
export enum Quality {
|
|
636
|
+
SD,
|
|
637
|
+
HD,
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
export enum Resolution {
|
|
641
|
+
Low = 720,
|
|
642
|
+
High = 1080,
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
export enum Floppy {
|
|
646
|
+
LowDensity = 0.72,
|
|
647
|
+
HighDensity = 1.44,
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
export enum StringOptions {
|
|
651
|
+
One = 'one',
|
|
652
|
+
Two = 'two',
|
|
653
|
+
Three = 'three',
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
export type ChooseInt = 1 | 2 | 3;
|
|
657
|
+
export type ChooseFloat = 1.44 | 2.88 | 5.76;
|
|
658
|
+
export type ChooseObject = {} | {low: string};
|
|
659
|
+
export type ChooseString = 'One' | 'Two' | 'Three';
|
|
660
|
+
|
|
661
|
+
export interface Spec extends TurboModule {
|
|
662
|
+
readonly getCallback: () => () => void;
|
|
663
|
+
readonly getMixed: (arg: unknown) => unknown;
|
|
664
|
+
readonly getEnums: (quality: Quality, resolution?: Resolution, floppy: Floppy, stringOptions: StringOptions) => string;
|
|
665
|
+
readonly getMap: (arg: {[a: string]: number | null;}) => {[b: string]: number | null;};
|
|
666
|
+
readonly getAnotherMap: (arg: {[key: string]: string}) => {[key: string]: string};
|
|
667
|
+
readonly getUnion: (chooseInt: ChooseInt, chooseFloat: ChooseFloat, chooseObject: ChooseObject, chooseString: ChooseString) => ChooseObject;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
export default TurboModuleRegistry.getEnforcing<Spec>(
|
|
671
|
+
'SampleTurboModuleCxx',
|
|
672
|
+
);
|
|
673
|
+
`;
|
|
674
|
+
module.exports = {
|
|
675
|
+
NATIVE_MODULE_WITH_OBJECT_WITH_OBJECT_DEFINED_IN_FILE_AS_PROPERTY,
|
|
676
|
+
NATIVE_MODULE_WITH_ARRAY_WITH_UNION_AND_TOUPLE,
|
|
677
|
+
NATIVE_MODULE_WITH_ARRAY2_WITH_UNION_AND_TOUPLE,
|
|
678
|
+
NATIVE_MODULE_WITH_FLOAT_AND_INT32,
|
|
679
|
+
NATIVE_MODULE_WITH_ALIASES,
|
|
680
|
+
NATIVE_MODULE_WITH_NESTED_ALIASES,
|
|
681
|
+
NATIVE_MODULE_WITH_PROMISE,
|
|
682
|
+
NATIVE_MODULE_WITH_COMPLEX_OBJECTS,
|
|
683
|
+
NATIVE_MODULE_WITH_COMPLEX_OBJECTS_WITH_NULLABLE_KEY,
|
|
684
|
+
NATIVE_MODULE_WITH_SIMPLE_OBJECT,
|
|
685
|
+
NATIVE_MODULE_WITH_UNSAFE_OBJECT,
|
|
686
|
+
NATIVE_MODULE_WITH_ROOT_TAG,
|
|
687
|
+
NATIVE_MODULE_WITH_NULLABLE_PARAM,
|
|
688
|
+
NATIVE_MODULE_WITH_BASIC_ARRAY,
|
|
689
|
+
NATIVE_MODULE_WITH_BASIC_ARRAY2,
|
|
690
|
+
NATIVE_MODULE_WITH_COMPLEX_ARRAY,
|
|
691
|
+
NATIVE_MODULE_WITH_COMPLEX_ARRAY2,
|
|
692
|
+
NATIVE_MODULE_WITH_ARRAY_WITH_ALIAS,
|
|
693
|
+
NATIVE_MODULE_WITH_ARRAY2_WITH_ALIAS,
|
|
694
|
+
NATIVE_MODULE_WITH_BASIC_PARAM_TYPES,
|
|
695
|
+
NATIVE_MODULE_WITH_CALLBACK,
|
|
696
|
+
NATIVE_MODULE_WITH_UNION,
|
|
697
|
+
EMPTY_NATIVE_MODULE,
|
|
698
|
+
ANDROID_ONLY_NATIVE_MODULE,
|
|
699
|
+
IOS_ONLY_NATIVE_MODULE,
|
|
700
|
+
CXX_ONLY_NATIVE_MODULE,
|
|
701
|
+
};
|