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