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