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