@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,583 @@
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 COMMANDS_DEFINED_INLINE = `
16
+ /**
17
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
18
+ *
19
+ * This source code is licensed under the MIT license found in the
20
+ * LICENSE file in the root directory of this source tree.
21
+ *
22
+ * @format
23
+ * @flow strict-local
24
+ */
25
+
26
+ 'use strict';
27
+
28
+ const codegenNativeCommands = require('codegenNativeCommands');
29
+ const codegenNativeComponent = require('codegenNativeComponent');
30
+
31
+ import type {Int32} from 'CodegenTypes';
32
+ import type {ViewProps} from 'ViewPropTypes';
33
+ import type {HostComponent} from 'react-native';
34
+
35
+ export type ModuleProps = $ReadOnly<{|
36
+ ...ViewProps,
37
+ // No props
38
+ |}>;
39
+
40
+ export const Commands = codegenNativeCommands<{
41
+ +hotspotUpdate: (ref: React.Ref<'RCTView'>, x: Int32, y: Int32) => void,
42
+ }>({
43
+ supportedCommands: ['hotspotUpdate'],
44
+ });
45
+
46
+ export default (codegenNativeComponent<ModuleProps>(
47
+ 'Module',
48
+ ): HostComponent<ModuleProps>);
49
+ `;
50
+ const COMMANDS_DEFINED_MULTIPLE_TIMES = `
51
+ /**
52
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
53
+ *
54
+ * This source code is licensed under the MIT license found in the
55
+ * LICENSE file in the root directory of this source tree.
56
+ *
57
+ * @format
58
+ * @flow strict-local
59
+ */
60
+
61
+ 'use strict';
62
+
63
+ const codegenNativeCommands = require('codegenNativeCommands');
64
+ const codegenNativeComponent = require('codegenNativeComponent');
65
+
66
+ import type {Int32} from 'CodegenTypes';
67
+ import type {ViewProps} from 'ViewPropTypes';
68
+ import type {HostComponent} from 'react-native';
69
+
70
+ interface NativeCommands {
71
+ +hotspotUpdate: (viewRef: React.Ref<'RCTView'>, x: Int32, y: Int32) => void;
72
+ }
73
+
74
+ export type ModuleProps = $ReadOnly<{|
75
+ ...ViewProps,
76
+ // No props or events
77
+ |}>;
78
+
79
+ export const Commands = codegenNativeCommands<NativeCommands>({
80
+ supportedCommands: ['hotspotUpdate'],
81
+ });
82
+ export const Commands2 = codegenNativeCommands<NativeCommands>({
83
+ supportedCommands: ['hotspotUpdate'],
84
+ });
85
+
86
+ export default (codegenNativeComponent<ModuleProps>(
87
+ 'Module',
88
+ ): HostComponent<ModuleProps>);
89
+ `;
90
+ const COMMANDS_DEFINED_WITHOUT_REF = `
91
+ /**
92
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
93
+ *
94
+ * This source code is licensed under the MIT license found in the
95
+ * LICENSE file in the root directory of this source tree.
96
+ *
97
+ * @format
98
+ * @flow strict-local
99
+ */
100
+
101
+ 'use strict';
102
+
103
+ const codegenNativeCommands = require('codegenNativeCommands');
104
+ const codegenNativeComponent = require('codegenNativeComponent');
105
+
106
+ import type {Int32} from 'CodegenTypes';
107
+ import type {ViewProps} from 'ViewPropTypes';
108
+ import type {HostComponent} from 'react-native';
109
+
110
+ interface NativeCommands {
111
+ +hotspotUpdate: (x: Int32, y: Int32) => void;
112
+ }
113
+
114
+ export type ModuleProps = $ReadOnly<{|
115
+ ...ViewProps,
116
+ // No props or events
117
+ |}>;
118
+
119
+ export const Commands = codegenNativeCommands<NativeCommands>({
120
+ supportedCommands: ['hotspotUpdate'],
121
+ });
122
+
123
+ export default (codegenNativeComponent<ModuleProps>(
124
+ 'Module',
125
+ ): HostComponent<ModuleProps>);
126
+ `;
127
+ const COMMANDS_DEFINED_WITH_NULLABLE_REF = `
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 codegenNativeCommands = require('codegenNativeCommands');
141
+ const codegenNativeComponent = require('codegenNativeComponent');
142
+
143
+ import type {Int32} from 'CodegenTypes';
144
+ import type {ViewProps} from 'ViewPropTypes';
145
+ import type {HostComponent} from 'react-native';
146
+
147
+ interface NativeCommands {
148
+ +hotspotUpdate: (viewRef: ?React.Ref<'RCTView'>, x: Int32, y: Int32) => void;
149
+ }
150
+
151
+ export type ModuleProps = $ReadOnly<{|
152
+ ...ViewProps,
153
+ // No props or events
154
+ |}>;
155
+
156
+ export const Commands = codegenNativeCommands<NativeCommands>({
157
+ supportedCommands: ['hotspotUpdate'],
158
+ });
159
+
160
+ export default (codegenNativeComponent<ModuleProps>(
161
+ 'Module',
162
+ ): HostComponent<ModuleProps>);
163
+ `;
164
+ const COMMANDS_DEFINED_WITH_MISMATCHED_METHOD_NAMES = `
165
+ /**
166
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
167
+ *
168
+ * This source code is licensed under the MIT license found in the
169
+ * LICENSE file in the root directory of this source tree.
170
+ *
171
+ * @format
172
+ * @flow strict-local
173
+ */
174
+
175
+ 'use strict';
176
+
177
+ const codegenNativeCommands = require('codegenNativeCommands');
178
+ const codegenNativeComponent = require('codegenNativeComponent');
179
+
180
+ import type {Int32} from 'CodegenTypes';
181
+ import type {ViewProps} from 'ViewPropTypes';
182
+ import type {HostComponent} from 'react-native';
183
+
184
+ interface NativeCommands {
185
+ +hotspotUpdate: (viewRef: React.Ref<'RCTView'>, x: Int32, y: Int32) => void;
186
+ +scrollTo: (
187
+ viewRef: React.Ref<'RCTView'>,
188
+ y: Int32,
189
+ animated: boolean,
190
+ ) => void;
191
+ }
192
+
193
+ export type ModuleProps = $ReadOnly<{|
194
+ ...ViewProps,
195
+ // No props or events
196
+ |}>;
197
+
198
+ export const Commands = codegenNativeCommands<NativeCommands>({
199
+ supportedCommands: ['scrollTo'],
200
+ });
201
+
202
+ export default (codegenNativeComponent<ModuleProps>(
203
+ 'Module',
204
+ ): HostComponent<ModuleProps>);
205
+ `;
206
+ const COMMANDS_DEFINED_WITHOUT_METHOD_NAMES = `
207
+ /**
208
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
209
+ *
210
+ * This source code is licensed under the MIT license found in the
211
+ * LICENSE file in the root directory of this source tree.
212
+ *
213
+ * @format
214
+ * @flow strict-local
215
+ */
216
+
217
+ 'use strict';
218
+
219
+ const codegenNativeCommands = require('codegenNativeCommands');
220
+ const codegenNativeComponent = require('codegenNativeComponent');
221
+
222
+ import type {Int32} from 'CodegenTypes';
223
+ import type {ViewProps} from 'ViewPropTypes';
224
+ import type {HostComponent} from 'react-native';
225
+
226
+ interface NativeCommands {
227
+ +hotspotUpdate: (viewRef: React.Ref<'RCTView'>, x: Int32, y: Int32) => void;
228
+ +scrollTo: (
229
+ viewRef: React.Ref<'RCTView'>,
230
+ y: Int32,
231
+ animated: boolean,
232
+ ) => void;
233
+ }
234
+
235
+ export type ModuleProps = $ReadOnly<{|
236
+ ...ViewProps,
237
+ // No props or events
238
+ |}>;
239
+
240
+ export const Commands = codegenNativeCommands<NativeCommands>();
241
+
242
+ export default (codegenNativeComponent<ModuleProps>(
243
+ 'Module',
244
+ ): HostComponent<ModuleProps>);
245
+ `;
246
+ const NULLABLE_WITH_DEFAULT = `
247
+ /**
248
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
249
+ *
250
+ * This source code is licensed under the MIT license found in the
251
+ * LICENSE file in the root directory of this source tree.
252
+ *
253
+ * @format
254
+ * @flow strict-local
255
+ */
256
+
257
+ 'use strict';
258
+
259
+ const codegenNativeComponent = require('codegenNativeComponent');
260
+
261
+ import type {WithDefault, Float} from 'CodegenTypes';
262
+ import type {ViewProps} from 'ViewPropTypes';
263
+ import type {HostComponent} from 'react-native';
264
+
265
+ export type ModuleProps = $ReadOnly<{|
266
+ ...ViewProps,
267
+ nullable_with_default: ?WithDefault<Float, 1.0>,
268
+ |}>;
269
+
270
+ export default (codegenNativeComponent<ModuleProps>(
271
+ 'Module',
272
+ ): HostComponent<ModuleProps>);
273
+ `;
274
+ const NON_OPTIONAL_KEY_WITH_DEFAULT_VALUE = `
275
+ /**
276
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
277
+ *
278
+ * This source code is licensed under the MIT license found in the
279
+ * LICENSE file in the root directory of this source tree.
280
+ *
281
+ * @format
282
+ * @flow strict-local
283
+ */
284
+
285
+ 'use strict';
286
+
287
+ const codegenNativeComponent = require('codegenNativeComponent');
288
+
289
+ import type {WithDefault, Float} from 'CodegenTypes';
290
+ import type {ViewProps} from 'ViewPropTypes';
291
+ import type {HostComponent} from 'react-native';
292
+
293
+ export type ModuleProps = $ReadOnly<{|
294
+ ...ViewProps,
295
+ required_key_with_default: WithDefault<Float, 1.0>,
296
+ |}>;
297
+
298
+ export default (codegenNativeComponent<ModuleProps>(
299
+ 'Module',
300
+ ): HostComponent<ModuleProps>);
301
+ `;
302
+ const PROPS_CONFLICT_NAMES = `
303
+ /**
304
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
305
+ *
306
+ * This source code is licensed under the MIT license found in the
307
+ * LICENSE file in the root directory of this source tree.
308
+ *
309
+ * @format
310
+ * @flow strict-local
311
+ */
312
+
313
+ 'use strict';
314
+
315
+ import type {ViewProps} from 'ViewPropTypes';
316
+ import type {HostComponent} from 'react-native';
317
+
318
+ const codegenNativeComponent = require('codegenNativeComponent');
319
+
320
+ export type ModuleProps = $ReadOnly<{|
321
+ ...ViewProps,
322
+ isEnabled: string,
323
+
324
+ isEnabled: boolean,
325
+ |}>;
326
+
327
+ export default (codegenNativeComponent<ModuleProps>(
328
+ 'Module',
329
+ ): HostComponent<ModuleProps>);
330
+ `;
331
+ const PROPS_CONFLICT_WITH_SPREAD_PROPS = `
332
+ /**
333
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
334
+ *
335
+ * This source code is licensed under the MIT license found in the
336
+ * LICENSE file in the root directory of this source tree.
337
+ *
338
+ * @format
339
+ * @flow strict-local
340
+ */
341
+
342
+ 'use strict';
343
+
344
+ import type {ViewProps} from 'ViewPropTypes';
345
+ import type {HostComponent} from 'react-native';
346
+
347
+ const codegenNativeComponent = require('codegenNativeComponent');
348
+
349
+ type PropsInFile = $ReadOnly<{|
350
+ isEnabled: boolean,
351
+ |}>;
352
+
353
+ export type ModuleProps = $ReadOnly<{|
354
+ ...ViewProps,
355
+
356
+ ...PropsInFile,
357
+ isEnabled: boolean,
358
+ |}>;
359
+
360
+ export default (codegenNativeComponent<ModuleProps>(
361
+ 'Module',
362
+ ): HostComponent<ModuleProps>);
363
+ `;
364
+ const PROPS_SPREAD_CONFLICTS_WITH_PROPS = `
365
+ /**
366
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
367
+ *
368
+ * This source code is licensed under the MIT license found in the
369
+ * LICENSE file in the root directory of this source tree.
370
+ *
371
+ * @format
372
+ * @flow strict-local
373
+ */
374
+
375
+ 'use strict';
376
+
377
+ import type {ViewProps} from 'ViewPropTypes';
378
+ import type {HostComponent} from 'react-native';
379
+
380
+ const codegenNativeComponent = require('codegenNativeComponent');
381
+
382
+ type PropsInFile = $ReadOnly<{|
383
+ isEnabled: boolean,
384
+ |}>;
385
+
386
+ export type ModuleProps = $ReadOnly<{|
387
+ ...ViewProps,
388
+
389
+ isEnabled: boolean,
390
+ ...PropsInFile,
391
+ |}>;
392
+
393
+ export default (codegenNativeComponent<ModuleProps>(
394
+ 'Module',
395
+ ): HostComponent<ModuleProps>);
396
+ `;
397
+ const PROP_NUMBER_TYPE = `
398
+ /**
399
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
400
+ *
401
+ * This source code is licensed under the MIT license found in the
402
+ * LICENSE file in the root directory of this source tree.
403
+ *
404
+ * @format
405
+ * @flow strict-local
406
+ */
407
+
408
+ 'use strict';
409
+
410
+ import type {ViewProps} from 'ViewPropTypes';
411
+ import type {HostComponent} from 'react-native';
412
+
413
+ const codegenNativeComponent = require('codegenNativeComponent');
414
+
415
+ export type ModuleProps = $ReadOnly<{|
416
+ ...ViewProps,
417
+
418
+ someProp: number
419
+ |}>;
420
+
421
+ export default (codegenNativeComponent<ModuleProps>(
422
+ 'Module',
423
+ ): HostComponent<ModuleProps>);
424
+ `;
425
+ const PROP_MIXED_ENUM = `
426
+ /**
427
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
428
+ *
429
+ * This source code is licensed under the MIT license found in the
430
+ * LICENSE file in the root directory of this source tree.
431
+ *
432
+ * @format
433
+ * @flow strict-local
434
+ */
435
+
436
+ 'use strict';
437
+
438
+ import type {ViewProps} from 'ViewPropTypes';
439
+ import type {HostComponent} from 'react-native';
440
+
441
+ const codegenNativeComponent = require('codegenNativeComponent');
442
+
443
+ export type ModuleProps = $ReadOnly<{|
444
+ ...ViewProps,
445
+
446
+ someProp?: WithDefault<'foo' | 1, 1>
447
+ |}>;
448
+
449
+ export default (codegenNativeComponent<ModuleProps>(
450
+ 'Module',
451
+ ): HostComponent<ModuleProps>);
452
+ `;
453
+ const PROP_ENUM_BOOLEAN = `
454
+ /**
455
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
456
+ *
457
+ * This source code is licensed under the MIT license found in the
458
+ * LICENSE file in the root directory of this source tree.
459
+ *
460
+ * @format
461
+ * @flow strict-local
462
+ */
463
+
464
+ 'use strict';
465
+
466
+ import type {ViewProps} from 'ViewPropTypes';
467
+ import type {HostComponent} from 'react-native';
468
+
469
+ const codegenNativeComponent = require('codegenNativeComponent');
470
+
471
+ export type ModuleProps = $ReadOnly<{|
472
+ ...ViewProps,
473
+
474
+ someProp?: WithDefault<false | true, false>
475
+ |}>;
476
+
477
+ export default (codegenNativeComponent<ModuleProps>(
478
+ 'Module',
479
+ ): HostComponent<ModuleProps>);
480
+ `;
481
+ const PROP_ARRAY_MIXED_ENUM = `
482
+ /**
483
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
484
+ *
485
+ * This source code is licensed under the MIT license found in the
486
+ * LICENSE file in the root directory of this source tree.
487
+ *
488
+ * @format
489
+ * @flow strict-local
490
+ */
491
+
492
+ 'use strict';
493
+
494
+ import type {ViewProps} from 'ViewPropTypes';
495
+ import type {HostComponent} from 'react-native';
496
+
497
+ const codegenNativeComponent = require('codegenNativeComponent');
498
+
499
+ export type ModuleProps = $ReadOnly<{|
500
+ ...ViewProps,
501
+
502
+ someProp?: WithDefault<$ReadOnlyArray<'foo' | 1>, 1>
503
+ |}>;
504
+
505
+ export default (codegenNativeComponent<ModuleProps>(
506
+ 'Module',
507
+ ): HostComponent<ModuleProps>);
508
+ `;
509
+ const PROP_ARRAY_ENUM_BOOLEAN = `
510
+ /**
511
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
512
+ *
513
+ * This source code is licensed under the MIT license found in the
514
+ * LICENSE file in the root directory of this source tree.
515
+ *
516
+ * @format
517
+ * @flow strict-local
518
+ */
519
+
520
+ 'use strict';
521
+
522
+ import type {ViewProps} from 'ViewPropTypes';
523
+ import type {HostComponent} from 'react-native';
524
+
525
+ const codegenNativeComponent = require('codegenNativeComponent');
526
+
527
+ export type ModuleProps = $ReadOnly<{|
528
+ ...ViewProps,
529
+
530
+ someProp?: WithDefault<$ReadOnlyArray<false | true>, false>
531
+ |}>;
532
+
533
+ export default (codegenNativeComponent<ModuleProps>(
534
+ 'Module',
535
+ ): HostComponent<ModuleProps>);
536
+ `;
537
+ const PROP_ARRAY_ENUM_INT = `
538
+ /**
539
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
540
+ *
541
+ * This source code is licensed under the MIT license found in the
542
+ * LICENSE file in the root directory of this source tree.
543
+ *
544
+ * @format
545
+ * @flow strict-local
546
+ */
547
+
548
+ 'use strict';
549
+
550
+ import type {ViewProps} from 'ViewPropTypes';
551
+ import type {HostComponent} from 'react-native';
552
+
553
+ const codegenNativeComponent = require('codegenNativeComponent');
554
+
555
+ export type ModuleProps = $ReadOnly<{|
556
+ ...ViewProps,
557
+
558
+ someProp?: WithDefault<$ReadOnlyArray<0 | 1>, 0>
559
+ |}>;
560
+
561
+ export default (codegenNativeComponent<ModuleProps>(
562
+ 'Module',
563
+ ): HostComponent<ModuleProps>);
564
+ `;
565
+ module.exports = {
566
+ COMMANDS_DEFINED_INLINE,
567
+ COMMANDS_DEFINED_MULTIPLE_TIMES,
568
+ COMMANDS_DEFINED_WITH_MISMATCHED_METHOD_NAMES,
569
+ COMMANDS_DEFINED_WITHOUT_METHOD_NAMES,
570
+ COMMANDS_DEFINED_WITHOUT_REF,
571
+ COMMANDS_DEFINED_WITH_NULLABLE_REF,
572
+ NULLABLE_WITH_DEFAULT,
573
+ NON_OPTIONAL_KEY_WITH_DEFAULT_VALUE,
574
+ PROPS_CONFLICT_NAMES,
575
+ PROPS_CONFLICT_WITH_SPREAD_PROPS,
576
+ PROPS_SPREAD_CONFLICTS_WITH_PROPS,
577
+ PROP_NUMBER_TYPE,
578
+ PROP_MIXED_ENUM,
579
+ PROP_ENUM_BOOLEAN,
580
+ PROP_ARRAY_MIXED_ENUM,
581
+ PROP_ARRAY_ENUM_BOOLEAN,
582
+ PROP_ARRAY_ENUM_INT,
583
+ };