@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,1016 @@
|
|
|
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 EVENT_DEFINITION = `
|
|
16
|
+
boolean_required: boolean,
|
|
17
|
+
boolean_optional_key?: boolean,
|
|
18
|
+
boolean_optional_value: ?boolean,
|
|
19
|
+
boolean_optional_both?: ?boolean,
|
|
20
|
+
|
|
21
|
+
string_required: string,
|
|
22
|
+
string_optional_key?: string,
|
|
23
|
+
string_optional_value: ?string,
|
|
24
|
+
string_optional_both?: ?string,
|
|
25
|
+
|
|
26
|
+
double_required: Double,
|
|
27
|
+
double_optional_key?: Double,
|
|
28
|
+
double_optional_value: ?Double,
|
|
29
|
+
double_optional_both?: ?Double,
|
|
30
|
+
|
|
31
|
+
float_required: Float,
|
|
32
|
+
float_optional_key?: Float,
|
|
33
|
+
float_optional_value: ?Float,
|
|
34
|
+
float_optional_both?: ?Float,
|
|
35
|
+
|
|
36
|
+
int32_required: Int32,
|
|
37
|
+
int32_optional_key?: Int32,
|
|
38
|
+
int32_optional_value: ?Int32,
|
|
39
|
+
int32_optional_both?: ?Int32,
|
|
40
|
+
|
|
41
|
+
enum_required: ('small' | 'large'),
|
|
42
|
+
enum_optional_key?: ('small' | 'large'),
|
|
43
|
+
enum_optional_value: ?('small' | 'large'),
|
|
44
|
+
enum_optional_both?: ?('small' | 'large'),
|
|
45
|
+
|
|
46
|
+
object_required: {
|
|
47
|
+
boolean_required: boolean,
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
object_optional_key?: {
|
|
51
|
+
string_optional_key?: string,
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
object_optional_value: ?{
|
|
55
|
+
float_optional_value: ?Float,
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
object_optional_both?: ?{
|
|
59
|
+
int32_optional_both?: ?Int32,
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
object_required_nested_2_layers: {
|
|
63
|
+
object_optional_nested_1_layer?: ?{
|
|
64
|
+
boolean_required: Int32,
|
|
65
|
+
string_optional_key?: string,
|
|
66
|
+
double_optional_value: ?Double,
|
|
67
|
+
float_optional_value: ?Float,
|
|
68
|
+
int32_optional_both?: ?Int32,
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
object_readonly_required: $ReadOnly<{
|
|
73
|
+
boolean_required: boolean,
|
|
74
|
+
}>,
|
|
75
|
+
|
|
76
|
+
object_readonly_optional_key?: $ReadOnly<{
|
|
77
|
+
string_optional_key?: string,
|
|
78
|
+
}>,
|
|
79
|
+
|
|
80
|
+
object_readonly_optional_value: ?$ReadOnly<{
|
|
81
|
+
float_optional_value: ?Float,
|
|
82
|
+
}>,
|
|
83
|
+
|
|
84
|
+
object_readonly_optional_both?: ?$ReadOnly<{
|
|
85
|
+
int32_optional_both?: ?Int32,
|
|
86
|
+
}>,
|
|
87
|
+
`;
|
|
88
|
+
|
|
89
|
+
const ONE_OF_EACH_PROP_EVENT_DEFAULT_AND_OPTIONS = `
|
|
90
|
+
/**
|
|
91
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
92
|
+
*
|
|
93
|
+
* This source code is licensed under the MIT license found in the
|
|
94
|
+
* LICENSE file in the root directory of this source tree.
|
|
95
|
+
*
|
|
96
|
+
* @format
|
|
97
|
+
* @flow strict-local
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
'use strict';
|
|
101
|
+
|
|
102
|
+
const codegenNativeComponent = require('codegenNativeComponent');
|
|
103
|
+
|
|
104
|
+
import type {
|
|
105
|
+
BubblingEventHandler,
|
|
106
|
+
DirectEventHandler,
|
|
107
|
+
WithDefault,
|
|
108
|
+
} from 'CodegenTypes';
|
|
109
|
+
import type {ViewProps} from 'ViewPropTypes';
|
|
110
|
+
import type {HostComponent} from 'react-native';
|
|
111
|
+
|
|
112
|
+
type ModuleProps = $ReadOnly<{|
|
|
113
|
+
...ViewProps,
|
|
114
|
+
|
|
115
|
+
// Props
|
|
116
|
+
boolean_default_true_optional_both?: WithDefault<boolean, true>,
|
|
117
|
+
|
|
118
|
+
// Events
|
|
119
|
+
onDirectEventDefinedInlineNull: DirectEventHandler<null>,
|
|
120
|
+
onBubblingEventDefinedInlineNull: BubblingEventHandler<null>,
|
|
121
|
+
|}>;
|
|
122
|
+
|
|
123
|
+
export default (codegenNativeComponent<ModuleProps>('Module', {
|
|
124
|
+
interfaceOnly: true,
|
|
125
|
+
paperComponentName: 'RCTModule',
|
|
126
|
+
}): HostComponent<ModuleProps>);
|
|
127
|
+
`;
|
|
128
|
+
|
|
129
|
+
const ONE_OF_EACH_PROP_EVENT_DEFAULT_AND_OPTIONS_NO_CAST = `
|
|
130
|
+
/**
|
|
131
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
132
|
+
*
|
|
133
|
+
* This source code is licensed under the MIT license found in the
|
|
134
|
+
* LICENSE file in the root directory of this source tree.
|
|
135
|
+
*
|
|
136
|
+
* @format
|
|
137
|
+
* @flow strict-local
|
|
138
|
+
*/
|
|
139
|
+
|
|
140
|
+
'use strict';
|
|
141
|
+
|
|
142
|
+
const codegenNativeComponent = require('codegenNativeComponent');
|
|
143
|
+
|
|
144
|
+
import type {
|
|
145
|
+
BubblingEventHandler,
|
|
146
|
+
DirectEventHandler,
|
|
147
|
+
WithDefault,
|
|
148
|
+
} from 'CodegenTypes';
|
|
149
|
+
import type {ViewProps} from 'ViewPropTypes';
|
|
150
|
+
import type {HostComponent} from 'react-native';
|
|
151
|
+
|
|
152
|
+
type ModuleProps = $ReadOnly<{|
|
|
153
|
+
...ViewProps,
|
|
154
|
+
|
|
155
|
+
// Props
|
|
156
|
+
boolean_default_true_optional_both?: WithDefault<boolean, true>,
|
|
157
|
+
|
|
158
|
+
// Events
|
|
159
|
+
onDirectEventDefinedInlineNull: DirectEventHandler<null>,
|
|
160
|
+
onBubblingEventDefinedInlineNull: BubblingEventHandler<null>,
|
|
161
|
+
|}>;
|
|
162
|
+
|
|
163
|
+
export default codegenNativeComponent<ModuleProps>('Module', {
|
|
164
|
+
interfaceOnly: true,
|
|
165
|
+
excludedPlatforms: ['android'],
|
|
166
|
+
paperComponentName: 'RCTModule',
|
|
167
|
+
});
|
|
168
|
+
`;
|
|
169
|
+
|
|
170
|
+
const NO_PROPS_EVENTS_ONLY_DEPRECATED_VIEW_CONFIG_NAME_OPTION = `
|
|
171
|
+
/**
|
|
172
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
173
|
+
*
|
|
174
|
+
* This source code is licensed under the MIT license found in the
|
|
175
|
+
* LICENSE file in the root directory of this source tree.
|
|
176
|
+
*
|
|
177
|
+
* @format
|
|
178
|
+
* @flow strict-local
|
|
179
|
+
*/
|
|
180
|
+
|
|
181
|
+
'use strict';
|
|
182
|
+
|
|
183
|
+
const codegenNativeComponent = require('codegenNativeComponent');
|
|
184
|
+
|
|
185
|
+
import type {ViewProps} from 'ViewPropTypes';
|
|
186
|
+
import type {HostComponent} from 'react-native';
|
|
187
|
+
|
|
188
|
+
type ModuleProps = $ReadOnly<{|
|
|
189
|
+
...ViewProps,
|
|
190
|
+
|}>;
|
|
191
|
+
|
|
192
|
+
export default (codegenNativeComponent<ModuleProps>('Module', {
|
|
193
|
+
deprecatedViewConfigName: 'DeprecateModuleName',
|
|
194
|
+
}): HostComponent<ModuleProps>);
|
|
195
|
+
`;
|
|
196
|
+
|
|
197
|
+
const ALL_PROP_TYPES_NO_EVENTS = `
|
|
198
|
+
/**
|
|
199
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
200
|
+
*
|
|
201
|
+
* This source code is licensed under the MIT license found in the
|
|
202
|
+
* LICENSE file in the root directory of this source tree.
|
|
203
|
+
*
|
|
204
|
+
* @format
|
|
205
|
+
* @flow strict-local
|
|
206
|
+
*/
|
|
207
|
+
|
|
208
|
+
'use strict';
|
|
209
|
+
|
|
210
|
+
const codegenNativeComponent = require('codegenNativeComponent');
|
|
211
|
+
|
|
212
|
+
import type {Int32, Double, Float, WithDefault} from 'CodegenTypes';
|
|
213
|
+
import type {ImageSource} from 'ImageSource';
|
|
214
|
+
import type {ColorValue, ColorArrayValue, PointValue, EdgeInsetsValue} from 'StyleSheetTypes';
|
|
215
|
+
import type {ViewProps} from 'ViewPropTypes';
|
|
216
|
+
import type {HostComponent} from 'react-native';
|
|
217
|
+
|
|
218
|
+
type ModuleProps = $ReadOnly<{|
|
|
219
|
+
...ViewProps,
|
|
220
|
+
|
|
221
|
+
// Props
|
|
222
|
+
// Boolean props
|
|
223
|
+
boolean_required: boolean,
|
|
224
|
+
boolean_optional_key?: WithDefault<boolean, true>,
|
|
225
|
+
boolean_optional_both?: WithDefault<boolean, true>,
|
|
226
|
+
|
|
227
|
+
// Boolean props, null default
|
|
228
|
+
boolean_null_optional_key?: WithDefault<boolean, null>,
|
|
229
|
+
boolean_null_optional_both?: WithDefault<boolean, null>,
|
|
230
|
+
|
|
231
|
+
// String props
|
|
232
|
+
string_required: string,
|
|
233
|
+
string_optional_key?: WithDefault<string, ''>,
|
|
234
|
+
string_optional_both?: WithDefault<string, ''>,
|
|
235
|
+
|
|
236
|
+
// String props, null default
|
|
237
|
+
string_null_optional_key?: WithDefault<string, null>,
|
|
238
|
+
string_null_optional_both?: WithDefault<string, null>,
|
|
239
|
+
|
|
240
|
+
// Stringish props
|
|
241
|
+
stringish_required: Stringish,
|
|
242
|
+
stringish_optional_key?: WithDefault<Stringish, ''>,
|
|
243
|
+
stringish_optional_both?: WithDefault<Stringish, ''>,
|
|
244
|
+
|
|
245
|
+
// Stringish props, null default
|
|
246
|
+
stringish_null_optional_key?: WithDefault<Stringish, null>,
|
|
247
|
+
stringish_null_optional_both?: WithDefault<Stringish, null>,
|
|
248
|
+
|
|
249
|
+
// Double props
|
|
250
|
+
double_required: Double,
|
|
251
|
+
double_optional_key?: WithDefault<Double, 1.1>,
|
|
252
|
+
double_optional_both?: WithDefault<Double, 1.1>,
|
|
253
|
+
|
|
254
|
+
// Float props
|
|
255
|
+
float_required: Float,
|
|
256
|
+
float_optional_key?: WithDefault<Float, 1.1>,
|
|
257
|
+
float_optional_both?: WithDefault<Float, 1.1>,
|
|
258
|
+
|
|
259
|
+
// Float props, null default
|
|
260
|
+
float_null_optional_key?: WithDefault<Float, null>,
|
|
261
|
+
float_null_optional_both?: WithDefault<Float, null>,
|
|
262
|
+
|
|
263
|
+
// Int32 props
|
|
264
|
+
int32_required: Int32,
|
|
265
|
+
int32_optional_key?: WithDefault<Int32, 1>,
|
|
266
|
+
int32_optional_both?: WithDefault<Int32, 1>,
|
|
267
|
+
|
|
268
|
+
// String enum props
|
|
269
|
+
enum_optional_key?: WithDefault<'small' | 'large', 'small'>,
|
|
270
|
+
enum_optional_both?: WithDefault<'small' | 'large', 'small'>,
|
|
271
|
+
|
|
272
|
+
// Int enum props
|
|
273
|
+
int_enum_optional_key?: WithDefault<0 | 1, 0>,
|
|
274
|
+
|
|
275
|
+
// Object props
|
|
276
|
+
object_optional_key?: $ReadOnly<{| prop: string |}>,
|
|
277
|
+
object_optional_both?: ?$ReadOnly<{| prop: string |}>,
|
|
278
|
+
object_optional_value: ?$ReadOnly<{| prop: string |}>,
|
|
279
|
+
|
|
280
|
+
// ImageSource props
|
|
281
|
+
image_required: ImageSource,
|
|
282
|
+
image_optional_value: ?ImageSource,
|
|
283
|
+
image_optional_both?: ?ImageSource,
|
|
284
|
+
|
|
285
|
+
// ColorValue props
|
|
286
|
+
color_required: ColorValue,
|
|
287
|
+
color_optional_key?: ColorValue,
|
|
288
|
+
color_optional_value: ?ColorValue,
|
|
289
|
+
color_optional_both?: ?ColorValue,
|
|
290
|
+
|
|
291
|
+
// ColorArrayValue props
|
|
292
|
+
color_array_required: ColorArrayValue,
|
|
293
|
+
color_array_optional_key?: ColorArrayValue,
|
|
294
|
+
color_array_optional_value: ?ColorArrayValue,
|
|
295
|
+
color_array_optional_both?: ?ColorArrayValue,
|
|
296
|
+
|
|
297
|
+
// ProcessedColorValue props
|
|
298
|
+
processed_color_required: ProcessedColorValue,
|
|
299
|
+
processed_color_optional_key?: ProcessedColorValue,
|
|
300
|
+
processed_color_optional_value: ?ProcessedColorValue,
|
|
301
|
+
processed_color_optional_both?: ?ProcessedColorValue,
|
|
302
|
+
|
|
303
|
+
// PointValue props
|
|
304
|
+
point_required: PointValue,
|
|
305
|
+
point_optional_key?: PointValue,
|
|
306
|
+
point_optional_value: ?PointValue,
|
|
307
|
+
point_optional_both?: ?PointValue,
|
|
308
|
+
|
|
309
|
+
// EdgeInsets props
|
|
310
|
+
insets_required: EdgeInsetsValue,
|
|
311
|
+
insets_optional_key?: EdgeInsetsValue,
|
|
312
|
+
insets_optional_value: ?EdgeInsetsValue,
|
|
313
|
+
insets_optional_both?: ?EdgeInsetsValue,
|
|
314
|
+
|}>;
|
|
315
|
+
|
|
316
|
+
export default (codegenNativeComponent<ModuleProps, Options>(
|
|
317
|
+
'Module',
|
|
318
|
+
): HostComponent<ModuleProps>);
|
|
319
|
+
`;
|
|
320
|
+
|
|
321
|
+
const ARRAY_PROP_TYPES_NO_EVENTS = `
|
|
322
|
+
/**
|
|
323
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
324
|
+
*
|
|
325
|
+
* This source code is licensed under the MIT license found in the
|
|
326
|
+
* LICENSE file in the root directory of this source tree.
|
|
327
|
+
*
|
|
328
|
+
* @format
|
|
329
|
+
* @flow strict-local
|
|
330
|
+
*/
|
|
331
|
+
|
|
332
|
+
'use strict';
|
|
333
|
+
|
|
334
|
+
const codegenNativeComponent = require('codegenNativeComponent');
|
|
335
|
+
|
|
336
|
+
import type {Int32, Double, Float, WithDefault} from 'CodegenTypes';
|
|
337
|
+
import type {ImageSource} from 'ImageSource';
|
|
338
|
+
import type {ColorValue, PointValue, ProcessColorValue, EdgeInsetsValue} from 'StyleSheetTypes';
|
|
339
|
+
import type {ViewProps} from 'ViewPropTypes';
|
|
340
|
+
import type {HostComponent} from 'react-native';
|
|
341
|
+
|
|
342
|
+
type ObjectType = $ReadOnly<{| prop: string |}>;
|
|
343
|
+
type ArrayObjectType = $ReadOnlyArray<$ReadOnly<{| prop: string |}>>;
|
|
344
|
+
|
|
345
|
+
type ModuleProps = $ReadOnly<{|
|
|
346
|
+
...ViewProps,
|
|
347
|
+
|
|
348
|
+
// Props
|
|
349
|
+
// Boolean props
|
|
350
|
+
array_boolean_required: $ReadOnlyArray<boolean>,
|
|
351
|
+
array_boolean_optional_key?: $ReadOnlyArray<boolean>,
|
|
352
|
+
array_boolean_optional_value: ?$ReadOnlyArray<boolean>,
|
|
353
|
+
array_boolean_optional_both?: ?$ReadOnlyArray<boolean>,
|
|
354
|
+
|
|
355
|
+
// String props
|
|
356
|
+
array_string_required: $ReadOnlyArray<string>,
|
|
357
|
+
array_string_optional_key?: $ReadOnlyArray<string>,
|
|
358
|
+
array_string_optional_value: ?$ReadOnlyArray<string>,
|
|
359
|
+
array_string_optional_both?: ?$ReadOnlyArray<string>,
|
|
360
|
+
|
|
361
|
+
// Double props
|
|
362
|
+
array_double_required: $ReadOnlyArray<Double>,
|
|
363
|
+
array_double_optional_key?: $ReadOnlyArray<Double>,
|
|
364
|
+
array_double_optional_value: ?$ReadOnlyArray<Double>,
|
|
365
|
+
array_double_optional_both?: ?$ReadOnlyArray<Double>,
|
|
366
|
+
|
|
367
|
+
// Float props
|
|
368
|
+
array_float_required: $ReadOnlyArray<Float>,
|
|
369
|
+
array_float_optional_key?: $ReadOnlyArray<Float>,
|
|
370
|
+
array_float_optional_value: ?$ReadOnlyArray<Float>,
|
|
371
|
+
array_float_optional_both?: ?$ReadOnlyArray<Float>,
|
|
372
|
+
|
|
373
|
+
// Int32 props
|
|
374
|
+
array_int32_required: $ReadOnlyArray<Int32>,
|
|
375
|
+
array_int32_optional_key?: $ReadOnlyArray<Int32>,
|
|
376
|
+
array_int32_optional_value: ?$ReadOnlyArray<Int32>,
|
|
377
|
+
array_int32_optional_both?: ?$ReadOnlyArray<Int32>,
|
|
378
|
+
|
|
379
|
+
// String enum props
|
|
380
|
+
array_enum_optional_key?: WithDefault<
|
|
381
|
+
$ReadOnlyArray<'small' | 'large'>,
|
|
382
|
+
'small',
|
|
383
|
+
>,
|
|
384
|
+
array_enum_optional_both?: WithDefault<
|
|
385
|
+
$ReadOnlyArray<'small' | 'large'>,
|
|
386
|
+
'small',
|
|
387
|
+
>,
|
|
388
|
+
|
|
389
|
+
// ImageSource props
|
|
390
|
+
array_image_required: $ReadOnlyArray<ImageSource>,
|
|
391
|
+
array_image_optional_key?: $ReadOnlyArray<ImageSource>,
|
|
392
|
+
array_image_optional_value: ?$ReadOnlyArray<ImageSource>,
|
|
393
|
+
array_image_optional_both?: ?$ReadOnlyArray<ImageSource>,
|
|
394
|
+
|
|
395
|
+
// ColorValue props
|
|
396
|
+
array_color_required: $ReadOnlyArray<ColorValue>,
|
|
397
|
+
array_color_optional_key?: $ReadOnlyArray<ColorValue>,
|
|
398
|
+
array_color_optional_value: ?$ReadOnlyArray<ColorValue>,
|
|
399
|
+
array_color_optional_both?: ?$ReadOnlyArray<ColorValue>,
|
|
400
|
+
|
|
401
|
+
// PointValue props
|
|
402
|
+
array_point_required: $ReadOnlyArray<PointValue>,
|
|
403
|
+
array_point_optional_key?: $ReadOnlyArray<PointValue>,
|
|
404
|
+
array_point_optional_value: ?$ReadOnlyArray<PointValue>,
|
|
405
|
+
array_point_optional_both?: ?$ReadOnlyArray<PointValue>,
|
|
406
|
+
|
|
407
|
+
// EdgeInsetsValue props
|
|
408
|
+
array_insets_required: $ReadOnlyArray<EdgeInsetsValue>,
|
|
409
|
+
array_insets_optional_key?: $ReadOnlyArray<EdgeInsetsValue>,
|
|
410
|
+
array_insets_optional_value: ?$ReadOnlyArray<EdgeInsetsValue>,
|
|
411
|
+
array_insets_optional_both?: ?$ReadOnlyArray<EdgeInsetsValue>,
|
|
412
|
+
|
|
413
|
+
// Object props
|
|
414
|
+
array_object_required: $ReadOnlyArray<$ReadOnly<{| prop: string |}>>,
|
|
415
|
+
array_object_optional_key?: $ReadOnlyArray<$ReadOnly<{| prop: string |}>>,
|
|
416
|
+
array_object_optional_value: ?ArrayObjectType,
|
|
417
|
+
array_object_optional_both?: ?$ReadOnlyArray<ObjectType>,
|
|
418
|
+
|
|
419
|
+
// Nested array object types
|
|
420
|
+
array_of_array_object_required: $ReadOnlyArray<
|
|
421
|
+
$ReadOnly<{|
|
|
422
|
+
// This needs to be the same name as the top level array above
|
|
423
|
+
array_object_required: $ReadOnlyArray<$ReadOnly<{| prop: string |}>>,
|
|
424
|
+
|}>
|
|
425
|
+
>,
|
|
426
|
+
array_of_array_object_optional_key?: $ReadOnlyArray<
|
|
427
|
+
$ReadOnly<{|
|
|
428
|
+
// This needs to be the same name as the top level array above
|
|
429
|
+
array_object_optional_key: $ReadOnlyArray<$ReadOnly<{| prop?: string |}>>,
|
|
430
|
+
|}>
|
|
431
|
+
>,
|
|
432
|
+
array_of_array_object_optional_value: ?$ReadOnlyArray<
|
|
433
|
+
$ReadOnly<{|
|
|
434
|
+
// This needs to be the same name as the top level array above
|
|
435
|
+
array_object_optional_value: $ReadOnlyArray<$ReadOnly<{| prop: ?string |}>>,
|
|
436
|
+
|}>
|
|
437
|
+
>,
|
|
438
|
+
array_of_array_object_optional_both?: ?$ReadOnlyArray<
|
|
439
|
+
$ReadOnly<{|
|
|
440
|
+
// This needs to be the same name as the top level array above
|
|
441
|
+
array_object_optional_both: $ReadOnlyArray<$ReadOnly<{| prop?: ?string |}>>,
|
|
442
|
+
|}>
|
|
443
|
+
>,
|
|
444
|
+
|
|
445
|
+
// Nested array of array of object types
|
|
446
|
+
array_of_array_of_object_required: $ReadOnlyArray<
|
|
447
|
+
$ReadOnlyArray<
|
|
448
|
+
$ReadOnly<{|
|
|
449
|
+
prop: string,
|
|
450
|
+
|}>,
|
|
451
|
+
>,
|
|
452
|
+
>,
|
|
453
|
+
|
|
454
|
+
// Nested array of array of object types (in file)
|
|
455
|
+
array_of_array_of_object_required_in_file: $ReadOnlyArray<
|
|
456
|
+
$ReadOnlyArray<ObjectType>,
|
|
457
|
+
>,
|
|
458
|
+
|
|
459
|
+
// Nested array of array of object types (with spread)
|
|
460
|
+
array_of_array_of_object_required_with_spread: $ReadOnlyArray<
|
|
461
|
+
$ReadOnlyArray<
|
|
462
|
+
$ReadOnly<{|
|
|
463
|
+
...ObjectType
|
|
464
|
+
|}>,
|
|
465
|
+
>,
|
|
466
|
+
>,
|
|
467
|
+
|}>;
|
|
468
|
+
|
|
469
|
+
export default (codegenNativeComponent<ModuleProps>(
|
|
470
|
+
'Module',
|
|
471
|
+
): HostComponent<ModuleProps>);
|
|
472
|
+
`;
|
|
473
|
+
|
|
474
|
+
const OBJECT_PROP_TYPES_NO_EVENTS = `
|
|
475
|
+
/**
|
|
476
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
477
|
+
*
|
|
478
|
+
* This source code is licensed under the MIT license found in the
|
|
479
|
+
* LICENSE file in the root directory of this source tree.
|
|
480
|
+
*
|
|
481
|
+
* @format
|
|
482
|
+
* @flow strict-local
|
|
483
|
+
*/
|
|
484
|
+
|
|
485
|
+
'use strict';
|
|
486
|
+
|
|
487
|
+
const codegenNativeComponent = require('codegenNativeComponent');
|
|
488
|
+
|
|
489
|
+
import type {Int32, Double, Float, WithDefault} from 'CodegenTypes';
|
|
490
|
+
import type {ImageSource} from 'ImageSource';
|
|
491
|
+
import type {ColorValue, PointValue, EdgeInsetsValue} from 'StyleSheetTypes';
|
|
492
|
+
import type {ViewProps} from 'ViewPropTypes';
|
|
493
|
+
import type {HostComponent} from 'react-native';
|
|
494
|
+
|
|
495
|
+
type ModuleProps = $ReadOnly<{|
|
|
496
|
+
...ViewProps,
|
|
497
|
+
|
|
498
|
+
// Props
|
|
499
|
+
// Boolean props
|
|
500
|
+
boolean_required: $ReadOnly<{|prop: boolean|}>,
|
|
501
|
+
boolean_optional: $ReadOnly<{|prop?: WithDefault<boolean, false>|}>,
|
|
502
|
+
|
|
503
|
+
// String props
|
|
504
|
+
string_required: $ReadOnly<{|prop: string|}>,
|
|
505
|
+
string_optional: $ReadOnly<{|prop?: WithDefault<string, ''>|}>,
|
|
506
|
+
|
|
507
|
+
// Double props
|
|
508
|
+
double_required: $ReadOnly<{|prop: Double|}>,
|
|
509
|
+
double_optional: $ReadOnly<{|prop?: WithDefault<Double, 0.0>|}>,
|
|
510
|
+
|
|
511
|
+
// Float props
|
|
512
|
+
float_required: $ReadOnly<{|prop: Float|}>,
|
|
513
|
+
float_optional: $ReadOnly<{|prop?: WithDefault<Float, 0.0>|}>,
|
|
514
|
+
|
|
515
|
+
// Int32 props
|
|
516
|
+
int_required: $ReadOnly<{|prop: Int32|}>,
|
|
517
|
+
int_optional: $ReadOnly<{|prop?: WithDefault<Int32, 0>|}>,
|
|
518
|
+
|
|
519
|
+
// String enum props
|
|
520
|
+
enum_optional: $ReadOnly<{|
|
|
521
|
+
prop?: WithDefault<$ReadOnlyArray<'small' | 'large'>, 'small'>,
|
|
522
|
+
|}>,
|
|
523
|
+
|
|
524
|
+
// ImageSource props
|
|
525
|
+
image_required: $ReadOnly<{|prop: ImageSource|}>,
|
|
526
|
+
image_optional_key: $ReadOnly<{|prop?: ImageSource|}>,
|
|
527
|
+
image_optional_value: $ReadOnly<{|prop: ?ImageSource|}>,
|
|
528
|
+
image_optional_both: $ReadOnly<{|prop?: ?ImageSource|}>,
|
|
529
|
+
|
|
530
|
+
// ColorValue props
|
|
531
|
+
color_required: $ReadOnly<{|prop: ColorValue|}>,
|
|
532
|
+
color_optional_key: $ReadOnly<{|prop?: ColorValue|}>,
|
|
533
|
+
color_optional_value: $ReadOnly<{|prop: ?ColorValue|}>,
|
|
534
|
+
color_optional_both: $ReadOnly<{|prop?: ?ColorValue|}>,
|
|
535
|
+
|
|
536
|
+
// ProcessedColorValue props
|
|
537
|
+
processed_color_required: $ReadOnly<{|prop: ProcessedColorValue|}>,
|
|
538
|
+
processed_color_optional_key: $ReadOnly<{|prop?: ProcessedColorValue|}>,
|
|
539
|
+
processed_color_optional_value: $ReadOnly<{|prop: ?ProcessedColorValue|}>,
|
|
540
|
+
processed_color_optional_both: $ReadOnly<{|prop?: ?ProcessedColorValue|}>,
|
|
541
|
+
|
|
542
|
+
// PointValue props
|
|
543
|
+
point_required: $ReadOnly<{|prop: PointValue|}>,
|
|
544
|
+
point_optional_key: $ReadOnly<{|prop?: PointValue|}>,
|
|
545
|
+
point_optional_value: $ReadOnly<{|prop: ?PointValue|}>,
|
|
546
|
+
point_optional_both: $ReadOnly<{|prop?: ?PointValue|}>,
|
|
547
|
+
|
|
548
|
+
// EdgeInsetsValue props
|
|
549
|
+
insets_required: $ReadOnly<{|prop: EdgeInsetsValue|}>,
|
|
550
|
+
insets_optional_key: $ReadOnly<{|prop?: EdgeInsetsValue|}>,
|
|
551
|
+
insets_optional_value: $ReadOnly<{|prop: ?EdgeInsetsValue|}>,
|
|
552
|
+
insets_optional_both: $ReadOnly<{|prop?: ?EdgeInsetsValue|}>,
|
|
553
|
+
|
|
554
|
+
// Nested object props
|
|
555
|
+
object_required: $ReadOnly<{|prop: $ReadOnly<{nestedProp: string}>|}>,
|
|
556
|
+
object_optional_key?: $ReadOnly<{|prop: $ReadOnly<{nestedProp: string}>|}>,
|
|
557
|
+
object_optional_value: ?$ReadOnly<{|prop: $ReadOnly<{nestedProp: string}>|}>,
|
|
558
|
+
object_optional_both?: ?$ReadOnly<{|prop: $ReadOnly<{nestedProp: string}>|}>,
|
|
559
|
+
|}>;
|
|
560
|
+
|
|
561
|
+
export default (codegenNativeComponent<ModuleProps>(
|
|
562
|
+
'Module',
|
|
563
|
+
): HostComponent<ModuleProps>);
|
|
564
|
+
`;
|
|
565
|
+
|
|
566
|
+
const PROPS_ALIASED_LOCALLY = `
|
|
567
|
+
/**
|
|
568
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
569
|
+
*
|
|
570
|
+
* This source code is licensed under the MIT license found in the
|
|
571
|
+
* LICENSE file in the root directory of this source tree.
|
|
572
|
+
*
|
|
573
|
+
* @format
|
|
574
|
+
* @flow strict-local
|
|
575
|
+
*/
|
|
576
|
+
|
|
577
|
+
'use strict';
|
|
578
|
+
|
|
579
|
+
import type {ViewProps} from 'ViewPropTypes';
|
|
580
|
+
import type {HostComponent} from 'react-native';
|
|
581
|
+
|
|
582
|
+
const codegenNativeComponent = require('codegenNativeComponent');
|
|
583
|
+
|
|
584
|
+
type DeepSpread = $ReadOnly<{|
|
|
585
|
+
otherStringProp: string,
|
|
586
|
+
|}>;
|
|
587
|
+
|
|
588
|
+
export type PropsInFile = $ReadOnly<{|
|
|
589
|
+
...DeepSpread,
|
|
590
|
+
isEnabled: boolean,
|
|
591
|
+
label: string,
|
|
592
|
+
|}>;
|
|
593
|
+
|
|
594
|
+
export type ModuleProps = $ReadOnly<{|
|
|
595
|
+
...ViewProps,
|
|
596
|
+
|
|
597
|
+
...PropsInFile,
|
|
598
|
+
|
|
599
|
+
localType: $ReadOnly<{|
|
|
600
|
+
...PropsInFile
|
|
601
|
+
|}>,
|
|
602
|
+
|
|
603
|
+
localArr: $ReadOnlyArray<PropsInFile>
|
|
604
|
+
|}>;
|
|
605
|
+
|
|
606
|
+
export default (codegenNativeComponent<ModuleProps>(
|
|
607
|
+
'Module',
|
|
608
|
+
): HostComponent<ModuleProps>);
|
|
609
|
+
`;
|
|
610
|
+
|
|
611
|
+
const EVENTS_DEFINED_INLINE_WITH_ALL_TYPES = `
|
|
612
|
+
/**
|
|
613
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
614
|
+
*
|
|
615
|
+
* This source code is licensed under the MIT license found in the
|
|
616
|
+
* LICENSE file in the root directory of this source tree.
|
|
617
|
+
*
|
|
618
|
+
* @format
|
|
619
|
+
* @flow strict-local
|
|
620
|
+
*/
|
|
621
|
+
|
|
622
|
+
'use strict';
|
|
623
|
+
|
|
624
|
+
import type {HostComponent} from 'react-native';
|
|
625
|
+
const codegenNativeComponent = require('codegenNativeComponent');
|
|
626
|
+
|
|
627
|
+
import type {
|
|
628
|
+
Int32,
|
|
629
|
+
Double,
|
|
630
|
+
Float,
|
|
631
|
+
BubblingEventHandler,
|
|
632
|
+
DirectEventHandler,
|
|
633
|
+
} from 'CodegenTypes';
|
|
634
|
+
|
|
635
|
+
import type {ViewProps} from 'ViewPropTypes';
|
|
636
|
+
|
|
637
|
+
type ModuleProps = $ReadOnly<{|
|
|
638
|
+
...ViewProps,
|
|
639
|
+
// No Props
|
|
640
|
+
|
|
641
|
+
// Events
|
|
642
|
+
onDirectEventDefinedInline:
|
|
643
|
+
DirectEventHandler<
|
|
644
|
+
$ReadOnly<{|
|
|
645
|
+
${EVENT_DEFINITION}
|
|
646
|
+
|}>,
|
|
647
|
+
>,
|
|
648
|
+
|
|
649
|
+
onDirectEventDefinedInlineOptionalKey?:
|
|
650
|
+
DirectEventHandler<
|
|
651
|
+
$ReadOnly<{|
|
|
652
|
+
${EVENT_DEFINITION}
|
|
653
|
+
|}>,
|
|
654
|
+
>,
|
|
655
|
+
|
|
656
|
+
onDirectEventDefinedInlineOptionalValue: ?
|
|
657
|
+
DirectEventHandler<
|
|
658
|
+
$ReadOnly<{|
|
|
659
|
+
${EVENT_DEFINITION}
|
|
660
|
+
|}>,
|
|
661
|
+
>,
|
|
662
|
+
|
|
663
|
+
onDirectEventDefinedInlineOptionalBoth?: ?
|
|
664
|
+
DirectEventHandler<
|
|
665
|
+
$ReadOnly<{|
|
|
666
|
+
${EVENT_DEFINITION}
|
|
667
|
+
|}>,
|
|
668
|
+
>,
|
|
669
|
+
|
|
670
|
+
onDirectEventDefinedInlineWithPaperName?: ?
|
|
671
|
+
DirectEventHandler<
|
|
672
|
+
$ReadOnly<{|
|
|
673
|
+
${EVENT_DEFINITION}
|
|
674
|
+
|}>,
|
|
675
|
+
'paperDirectEventDefinedInlineWithPaperName',
|
|
676
|
+
>,
|
|
677
|
+
|
|
678
|
+
onBubblingEventDefinedInline:
|
|
679
|
+
BubblingEventHandler<
|
|
680
|
+
$ReadOnly<{|
|
|
681
|
+
${EVENT_DEFINITION}
|
|
682
|
+
|}>,
|
|
683
|
+
>,
|
|
684
|
+
|
|
685
|
+
onBubblingEventDefinedInlineOptionalKey?:
|
|
686
|
+
BubblingEventHandler<
|
|
687
|
+
$ReadOnly<{|
|
|
688
|
+
${EVENT_DEFINITION}
|
|
689
|
+
|}>,
|
|
690
|
+
>,
|
|
691
|
+
|
|
692
|
+
onBubblingEventDefinedInlineOptionalValue: ?
|
|
693
|
+
BubblingEventHandler<
|
|
694
|
+
$ReadOnly<{|
|
|
695
|
+
${EVENT_DEFINITION}
|
|
696
|
+
|}>,
|
|
697
|
+
>,
|
|
698
|
+
|
|
699
|
+
onBubblingEventDefinedInlineOptionalBoth?: ?
|
|
700
|
+
BubblingEventHandler<
|
|
701
|
+
$ReadOnly<{|
|
|
702
|
+
${EVENT_DEFINITION}
|
|
703
|
+
|}>,
|
|
704
|
+
>,
|
|
705
|
+
|
|
706
|
+
onBubblingEventDefinedInlineWithPaperName?: ?
|
|
707
|
+
BubblingEventHandler<
|
|
708
|
+
$ReadOnly<{|
|
|
709
|
+
${EVENT_DEFINITION}
|
|
710
|
+
|}>,
|
|
711
|
+
'paperBubblingEventDefinedInlineWithPaperName'
|
|
712
|
+
>,
|
|
713
|
+
|}>;
|
|
714
|
+
|
|
715
|
+
export default (codegenNativeComponent<ModuleProps>(
|
|
716
|
+
'Module',
|
|
717
|
+
): HostComponent<ModuleProps>);
|
|
718
|
+
`;
|
|
719
|
+
|
|
720
|
+
const EVENTS_DEFINED_AS_NULL_INLINE = `
|
|
721
|
+
/**
|
|
722
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
723
|
+
*
|
|
724
|
+
* This source code is licensed under the MIT license found in the
|
|
725
|
+
* LICENSE file in the root directory of this source tree.
|
|
726
|
+
*
|
|
727
|
+
* @format
|
|
728
|
+
* @flow strict-local
|
|
729
|
+
*/
|
|
730
|
+
|
|
731
|
+
'use strict';
|
|
732
|
+
|
|
733
|
+
const codegenNativeComponent = require('codegenNativeComponent');
|
|
734
|
+
|
|
735
|
+
import type {BubblingEventHandler, DirectEventHandler} from 'CodegenTypese';
|
|
736
|
+
import type {ViewProps} from 'ViewPropTypes';
|
|
737
|
+
import type {HostComponent} from 'react-native';
|
|
738
|
+
|
|
739
|
+
type ModuleProps = $ReadOnly<{|
|
|
740
|
+
...ViewProps,
|
|
741
|
+
|
|
742
|
+
// No props
|
|
743
|
+
|
|
744
|
+
// Events defined inline
|
|
745
|
+
onDirectEventDefinedInlineNull: DirectEventHandler<null>,
|
|
746
|
+
onDirectEventDefinedInlineNullOptionalKey?: DirectEventHandler<null>,
|
|
747
|
+
onDirectEventDefinedInlineNullOptionalValue: ?DirectEventHandler<null>,
|
|
748
|
+
onDirectEventDefinedInlineNullOptionalBoth?: DirectEventHandler<null>,
|
|
749
|
+
onDirectEventDefinedInlineNullWithPaperName?: ?DirectEventHandler<
|
|
750
|
+
null,
|
|
751
|
+
'paperDirectEventDefinedInlineNullWithPaperName',
|
|
752
|
+
>,
|
|
753
|
+
|
|
754
|
+
onBubblingEventDefinedInlineNull: BubblingEventHandler<null>,
|
|
755
|
+
onBubblingEventDefinedInlineNullOptionalKey?: BubblingEventHandler<null>,
|
|
756
|
+
onBubblingEventDefinedInlineNullOptionalValue: ?BubblingEventHandler<null>,
|
|
757
|
+
onBubblingEventDefinedInlineNullOptionalBoth?: ?BubblingEventHandler<null>,
|
|
758
|
+
onBubblingEventDefinedInlineNullWithPaperName?: ?BubblingEventHandler<
|
|
759
|
+
null,
|
|
760
|
+
'paperBubblingEventDefinedInlineNullWithPaperName',
|
|
761
|
+
>,
|
|
762
|
+
|}>;
|
|
763
|
+
|
|
764
|
+
export default (codegenNativeComponent<ModuleProps>(
|
|
765
|
+
'Module',
|
|
766
|
+
): HostComponent<ModuleProps>);
|
|
767
|
+
`;
|
|
768
|
+
|
|
769
|
+
const PROPS_AND_EVENTS_TYPES_EXPORTED = `
|
|
770
|
+
/**
|
|
771
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
772
|
+
*
|
|
773
|
+
* This source code is licensed under the MIT license found in the
|
|
774
|
+
* LICENSE file in the root directory of this source tree.
|
|
775
|
+
*
|
|
776
|
+
* @format
|
|
777
|
+
* @flow strict-local
|
|
778
|
+
*/
|
|
779
|
+
|
|
780
|
+
'use strict';
|
|
781
|
+
|
|
782
|
+
import type {
|
|
783
|
+
BubblingEventHandler,
|
|
784
|
+
DirectEventHandler,
|
|
785
|
+
} from 'CodegenTypes';
|
|
786
|
+
import type {ViewProps} from 'ViewPropTypes';
|
|
787
|
+
import type {HostComponent} from 'react-native';
|
|
788
|
+
|
|
789
|
+
const codegenNativeComponent = require('codegenNativeComponent');
|
|
790
|
+
|
|
791
|
+
export type EventInFile = $ReadOnly<{|
|
|
792
|
+
${EVENT_DEFINITION}
|
|
793
|
+
|}>;
|
|
794
|
+
|
|
795
|
+
export type ModuleProps = $ReadOnly<{|
|
|
796
|
+
...ViewProps,
|
|
797
|
+
|
|
798
|
+
// No props
|
|
799
|
+
|
|
800
|
+
// Events defined inline
|
|
801
|
+
onBubblingEventDefinedInline: BubblingEventHandler<EventInFile>,
|
|
802
|
+
onBubblingEventDefinedInlineWithPaperName: BubblingEventHandler<EventInFile, 'paperBubblingEventDefinedInlineWithPaperName'>,
|
|
803
|
+
onDirectEventDefinedInline: DirectEventHandler<EventInFile>,
|
|
804
|
+
onDirectEventDefinedInlineWithPaperName: DirectEventHandler<EventInFile, 'paperDirectEventDefinedInlineWithPaperName'>,
|
|
805
|
+
|}>;
|
|
806
|
+
|
|
807
|
+
export default (codegenNativeComponent<ModuleProps>(
|
|
808
|
+
'Module',
|
|
809
|
+
): HostComponent<ModuleProps>);
|
|
810
|
+
`;
|
|
811
|
+
|
|
812
|
+
const PROPS_AS_EXTERNAL_TYPES = `
|
|
813
|
+
/**
|
|
814
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
815
|
+
*
|
|
816
|
+
* This source code is licensed under the MIT license found in the
|
|
817
|
+
* LICENSE file in the root directory of this source tree.
|
|
818
|
+
*
|
|
819
|
+
* @format
|
|
820
|
+
* @flow strict-local
|
|
821
|
+
*/
|
|
822
|
+
|
|
823
|
+
'use strict';
|
|
824
|
+
|
|
825
|
+
const codegenNativeComponent = require('codegenNativeComponent');
|
|
826
|
+
|
|
827
|
+
import type {HostComponent} from 'react-native';
|
|
828
|
+
|
|
829
|
+
export type String = string;
|
|
830
|
+
export type AnotherArray = $ReadOnlyArray<String>;
|
|
831
|
+
|
|
832
|
+
export type ModuleProps = $ReadOnly<{|
|
|
833
|
+
disable: String,
|
|
834
|
+
array: AnotherArray,
|
|
835
|
+
|}>;
|
|
836
|
+
|
|
837
|
+
export default (codegenNativeComponent<ModuleProps>(
|
|
838
|
+
'Module',
|
|
839
|
+
): HostComponent<ModuleProps>);
|
|
840
|
+
`;
|
|
841
|
+
|
|
842
|
+
const COMMANDS_DEFINED_WITH_ALL_TYPES = `
|
|
843
|
+
/**
|
|
844
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
845
|
+
*
|
|
846
|
+
* This source code is licensed under the MIT license found in the
|
|
847
|
+
* LICENSE file in the root directory of this source tree.
|
|
848
|
+
*
|
|
849
|
+
* @format
|
|
850
|
+
* @flow strict-local
|
|
851
|
+
*/
|
|
852
|
+
|
|
853
|
+
'use strict';
|
|
854
|
+
|
|
855
|
+
const codegenNativeCommands = require('codegenNativeCommands');
|
|
856
|
+
const codegenNativeComponent = require('codegenNativeComponent');
|
|
857
|
+
|
|
858
|
+
import type {Int32, Double, Float} from 'CodegenTypes';
|
|
859
|
+
import type {RootTag} from 'RCTExport';
|
|
860
|
+
import type {ViewProps} from 'ViewPropTypes';
|
|
861
|
+
import type {HostComponent} from 'react-native';
|
|
862
|
+
|
|
863
|
+
|
|
864
|
+
export type ModuleProps = $ReadOnly<{|
|
|
865
|
+
...ViewProps,
|
|
866
|
+
// No props or events
|
|
867
|
+
|}>;
|
|
868
|
+
|
|
869
|
+
type NativeType = HostComponent<ModuleProps>;
|
|
870
|
+
|
|
871
|
+
interface NativeCommands {
|
|
872
|
+
+handleRootTag: (viewRef: React.ElementRef<NativeType>, rootTag: RootTag) => void;
|
|
873
|
+
+hotspotUpdate: (viewRef: React.ElementRef<NativeType>, x: Int32, y: Int32) => void;
|
|
874
|
+
scrollTo(
|
|
875
|
+
viewRef: React.ElementRef<NativeType>,
|
|
876
|
+
x: Float,
|
|
877
|
+
y: Int32,
|
|
878
|
+
z: Double,
|
|
879
|
+
animated: boolean,
|
|
880
|
+
): void;
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
export const Commands = codegenNativeCommands<NativeCommands>({
|
|
884
|
+
supportedCommands: ['handleRootTag', 'hotspotUpdate', 'scrollTo'],
|
|
885
|
+
});
|
|
886
|
+
|
|
887
|
+
export default (codegenNativeComponent<ModuleProps>(
|
|
888
|
+
'Module',
|
|
889
|
+
): NativeType);
|
|
890
|
+
`;
|
|
891
|
+
|
|
892
|
+
const COMMANDS_WITH_EXTERNAL_TYPES = `
|
|
893
|
+
/**
|
|
894
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
895
|
+
*
|
|
896
|
+
* This source code is licensed under the MIT license found in the
|
|
897
|
+
* LICENSE file in the root directory of this source tree.
|
|
898
|
+
*
|
|
899
|
+
* @format
|
|
900
|
+
* @flow strict-local
|
|
901
|
+
*/
|
|
902
|
+
|
|
903
|
+
'use strict';
|
|
904
|
+
|
|
905
|
+
const codegenNativeCommands = require('codegenNativeCommands');
|
|
906
|
+
const codegenNativeComponent = require('codegenNativeComponent');
|
|
907
|
+
|
|
908
|
+
import type {Int32} from 'CodegenTypes';
|
|
909
|
+
import type {ViewProps} from 'ViewPropTypes';
|
|
910
|
+
import type {HostComponent} from 'react-native';
|
|
911
|
+
|
|
912
|
+
export type Boolean = boolean;
|
|
913
|
+
export type Int = Int32;
|
|
914
|
+
export type Void = void;
|
|
915
|
+
|
|
916
|
+
export type ModuleProps = $ReadOnly<{|
|
|
917
|
+
...ViewProps,
|
|
918
|
+
// No props or events
|
|
919
|
+
|}>;
|
|
920
|
+
|
|
921
|
+
type NativeType = HostComponent<ModuleProps>;
|
|
922
|
+
|
|
923
|
+
export type ScrollTo = (
|
|
924
|
+
viewRef: React.ElementRef<NativeType>,
|
|
925
|
+
y: Int,
|
|
926
|
+
animated: Boolean,
|
|
927
|
+
) => Void;
|
|
928
|
+
|
|
929
|
+
interface NativeCommands {
|
|
930
|
+
+scrollTo: ScrollTo;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
export const Commands = codegenNativeCommands<NativeCommands>({
|
|
934
|
+
supportedCommands: ['scrollTo'],
|
|
935
|
+
});
|
|
936
|
+
|
|
937
|
+
export default (codegenNativeComponent<ModuleProps>(
|
|
938
|
+
'Module',
|
|
939
|
+
): NativeType);
|
|
940
|
+
`;
|
|
941
|
+
|
|
942
|
+
const COMMANDS_EVENTS_TYPES_EXPORTED = `
|
|
943
|
+
/**
|
|
944
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
945
|
+
*
|
|
946
|
+
* This source code is licensed under the MIT license found in the
|
|
947
|
+
* LICENSE file in the root directory of this source tree.
|
|
948
|
+
*
|
|
949
|
+
* @format
|
|
950
|
+
* @flow strict-local
|
|
951
|
+
*/
|
|
952
|
+
|
|
953
|
+
'use strict';
|
|
954
|
+
|
|
955
|
+
import type {
|
|
956
|
+
BubblingEventHandler,
|
|
957
|
+
DirectEventHandler,
|
|
958
|
+
} from 'CodegenTypes';
|
|
959
|
+
import type {ViewProps} from 'ViewPropTypes';
|
|
960
|
+
import type {HostComponent} from 'react-native';
|
|
961
|
+
|
|
962
|
+
const codegenNativeComponent = require('codegenNativeComponent');
|
|
963
|
+
|
|
964
|
+
export type EventInFile = $ReadOnly<{|
|
|
965
|
+
${EVENT_DEFINITION}
|
|
966
|
+
|}>;
|
|
967
|
+
|
|
968
|
+
export type Boolean = boolean;
|
|
969
|
+
export type Int = Int32;
|
|
970
|
+
export type Void = void;
|
|
971
|
+
|
|
972
|
+
export type ModuleProps = $ReadOnly<{|
|
|
973
|
+
...ViewProps,
|
|
974
|
+
|
|
975
|
+
// No props
|
|
976
|
+
|
|
977
|
+
// Events defined inline
|
|
978
|
+
onBubblingEventDefinedInline: BubblingEventHandler<EventInFile>,
|
|
979
|
+
onBubblingEventDefinedInlineWithPaperName: BubblingEventHandler<EventInFile, 'paperBubblingEventDefinedInlineWithPaperName'>,
|
|
980
|
+
onDirectEventDefinedInline: DirectEventHandler<EventInFile>,
|
|
981
|
+
onDirectEventDefinedInlineWithPaperName: DirectEventHandler<EventInFile, 'paperDirectEventDefinedInlineWithPaperName'>,
|
|
982
|
+
|}>;
|
|
983
|
+
|
|
984
|
+
type NativeType = HostComponent<ModuleProps>;
|
|
985
|
+
|
|
986
|
+
export type ScrollTo = (viewRef: React.ElementRef<NativeType>, y: Int, animated: Boolean) => Void;
|
|
987
|
+
|
|
988
|
+
interface NativeCommands {
|
|
989
|
+
+scrollTo: ScrollTo;
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
export const Commands = codegenNativeCommands<NativeCommands>({
|
|
993
|
+
supportedCommands: ['scrollTo']
|
|
994
|
+
});
|
|
995
|
+
|
|
996
|
+
export default (codegenNativeComponent<ModuleProps>(
|
|
997
|
+
'Module',
|
|
998
|
+
): NativeType);
|
|
999
|
+
`;
|
|
1000
|
+
|
|
1001
|
+
module.exports = {
|
|
1002
|
+
ALL_PROP_TYPES_NO_EVENTS,
|
|
1003
|
+
ARRAY_PROP_TYPES_NO_EVENTS,
|
|
1004
|
+
OBJECT_PROP_TYPES_NO_EVENTS,
|
|
1005
|
+
PROPS_ALIASED_LOCALLY,
|
|
1006
|
+
ONE_OF_EACH_PROP_EVENT_DEFAULT_AND_OPTIONS,
|
|
1007
|
+
ONE_OF_EACH_PROP_EVENT_DEFAULT_AND_OPTIONS_NO_CAST,
|
|
1008
|
+
NO_PROPS_EVENTS_ONLY_DEPRECATED_VIEW_CONFIG_NAME_OPTION,
|
|
1009
|
+
EVENTS_DEFINED_INLINE_WITH_ALL_TYPES,
|
|
1010
|
+
EVENTS_DEFINED_AS_NULL_INLINE,
|
|
1011
|
+
PROPS_AND_EVENTS_TYPES_EXPORTED,
|
|
1012
|
+
COMMANDS_EVENTS_TYPES_EXPORTED,
|
|
1013
|
+
COMMANDS_DEFINED_WITH_ALL_TYPES,
|
|
1014
|
+
PROPS_AS_EXTERNAL_TYPES,
|
|
1015
|
+
COMMANDS_WITH_EXTERNAL_TYPES,
|
|
1016
|
+
};
|