@react-native/codegen 0.72.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -0
- package/lib/CodegenSchema.js +11 -0
- package/lib/CodegenSchema.js.flow +351 -0
- package/lib/SchemaValidator.js +54 -0
- package/lib/SchemaValidator.js.flow +67 -0
- package/lib/cli/combine/combine-js-to-schema-cli.js +50 -0
- package/lib/cli/combine/combine-js-to-schema-cli.js.flow +49 -0
- package/lib/cli/combine/combine-js-to-schema.js +110 -0
- package/lib/cli/combine/combine-js-to-schema.js.flow +48 -0
- package/lib/cli/combine/combine-utils.js +118 -0
- package/lib/cli/combine/combine-utils.js.flow +85 -0
- package/lib/cli/generators/generate-all.js +65 -0
- package/lib/cli/generators/generate-all.js.flow +66 -0
- package/lib/cli/parser/parser-cli.js +55 -0
- package/lib/cli/parser/parser-cli.js.flow +18 -0
- package/lib/cli/parser/parser.js +35 -0
- package/lib/cli/parser/parser.js.flow +37 -0
- package/lib/cli/parser/parser.sh +15 -0
- package/lib/generators/RNCodegen.js +207 -0
- package/lib/generators/RNCodegen.js.flow +284 -0
- package/lib/generators/Utils.js +31 -0
- package/lib/generators/Utils.js.flow +33 -0
- package/lib/generators/__test_fixtures__/fixtures.js +79 -0
- package/lib/generators/__test_fixtures__/fixtures.js.flow +82 -0
- package/lib/generators/components/ComponentsGeneratorUtils.js +217 -0
- package/lib/generators/components/ComponentsGeneratorUtils.js.flow +304 -0
- package/lib/generators/components/CppHelpers.js +188 -0
- package/lib/generators/components/CppHelpers.js.flow +228 -0
- package/lib/generators/components/GenerateComponentDescriptorH.js +75 -0
- package/lib/generators/components/GenerateComponentDescriptorH.js.flow +95 -0
- package/lib/generators/components/GenerateComponentHObjCpp.js +327 -0
- package/lib/generators/components/GenerateComponentHObjCpp.js.flow +418 -0
- package/lib/generators/components/GenerateEventEmitterCpp.js +199 -0
- package/lib/generators/components/GenerateEventEmitterCpp.js.flow +273 -0
- package/lib/generators/components/GenerateEventEmitterH.js +224 -0
- package/lib/generators/components/GenerateEventEmitterH.js.flow +315 -0
- package/lib/generators/components/GeneratePropsCpp.js +126 -0
- package/lib/generators/components/GeneratePropsCpp.js.flow +161 -0
- package/lib/generators/components/GeneratePropsH.js +606 -0
- package/lib/generators/components/GeneratePropsH.js.flow +778 -0
- package/lib/generators/components/GeneratePropsJavaDelegate.js +287 -0
- package/lib/generators/components/GeneratePropsJavaDelegate.js.flow +348 -0
- package/lib/generators/components/GeneratePropsJavaInterface.js +237 -0
- package/lib/generators/components/GeneratePropsJavaInterface.js.flow +288 -0
- package/lib/generators/components/GeneratePropsJavaPojo/PojoCollector.js +157 -0
- package/lib/generators/components/GeneratePropsJavaPojo/PojoCollector.js.flow +187 -0
- package/lib/generators/components/GeneratePropsJavaPojo/index.js +66 -0
- package/lib/generators/components/GeneratePropsJavaPojo/index.js.flow +80 -0
- package/lib/generators/components/GeneratePropsJavaPojo/serializePojo.js +273 -0
- package/lib/generators/components/GeneratePropsJavaPojo/serializePojo.js.flow +296 -0
- package/lib/generators/components/GenerateShadowNodeCpp.js +73 -0
- package/lib/generators/components/GenerateShadowNodeCpp.js.flow +95 -0
- package/lib/generators/components/GenerateShadowNodeH.js +91 -0
- package/lib/generators/components/GenerateShadowNodeH.js.flow +124 -0
- package/lib/generators/components/GenerateStateCpp.js +70 -0
- package/lib/generators/components/GenerateStateCpp.js.flow +92 -0
- package/lib/generators/components/GenerateStateH.js +93 -0
- package/lib/generators/components/GenerateStateH.js.flow +111 -0
- package/lib/generators/components/GenerateTests.js +165 -0
- package/lib/generators/components/GenerateTests.js.flow +219 -0
- package/lib/generators/components/GenerateThirdPartyFabricComponentsProviderH.js +91 -0
- package/lib/generators/components/GenerateThirdPartyFabricComponentsProviderH.js.flow +107 -0
- package/lib/generators/components/GenerateThirdPartyFabricComponentsProviderObjCpp.js +89 -0
- package/lib/generators/components/GenerateThirdPartyFabricComponentsProviderObjCpp.js.flow +105 -0
- package/lib/generators/components/GenerateViewConfigJs.js +410 -0
- package/lib/generators/components/GenerateViewConfigJs.js.flow +484 -0
- package/lib/generators/components/JavaHelpers.js +87 -0
- package/lib/generators/components/JavaHelpers.js.flow +119 -0
- package/lib/generators/components/__test_fixtures__/fixtures.js +1641 -0
- package/lib/generators/components/__test_fixtures__/fixtures.js.flow +1672 -0
- package/lib/generators/modules/GenerateModuleCpp.js +299 -0
- package/lib/generators/modules/GenerateModuleCpp.js.flow +278 -0
- package/lib/generators/modules/GenerateModuleH.js +373 -0
- package/lib/generators/modules/GenerateModuleH.js.flow +355 -0
- package/lib/generators/modules/GenerateModuleJavaSpec.js +571 -0
- package/lib/generators/modules/GenerateModuleJavaSpec.js.flow +553 -0
- package/lib/generators/modules/GenerateModuleJniCpp.js +505 -0
- package/lib/generators/modules/GenerateModuleJniCpp.js.flow +523 -0
- package/lib/generators/modules/GenerateModuleJniH.js +138 -0
- package/lib/generators/modules/GenerateModuleJniH.js.flow +148 -0
- package/lib/generators/modules/GenerateModuleObjCpp/StructCollector.js +262 -0
- package/lib/generators/modules/GenerateModuleObjCpp/StructCollector.js.flow +208 -0
- package/lib/generators/modules/GenerateModuleObjCpp/Utils.js +25 -0
- package/lib/generators/modules/GenerateModuleObjCpp/Utils.js.flow +32 -0
- package/lib/generators/modules/GenerateModuleObjCpp/header/serializeConstantsStruct.js +337 -0
- package/lib/generators/modules/GenerateModuleObjCpp/header/serializeConstantsStruct.js.flow +288 -0
- package/lib/generators/modules/GenerateModuleObjCpp/header/serializeRegularStruct.js +330 -0
- package/lib/generators/modules/GenerateModuleObjCpp/header/serializeRegularStruct.js.flow +279 -0
- package/lib/generators/modules/GenerateModuleObjCpp/header/serializeStruct.js +25 -0
- package/lib/generators/modules/GenerateModuleObjCpp/header/serializeStruct.js.flow +35 -0
- package/lib/generators/modules/GenerateModuleObjCpp/index.js +185 -0
- package/lib/generators/modules/GenerateModuleObjCpp/index.js.flow +219 -0
- package/lib/generators/modules/GenerateModuleObjCpp/serializeMethod.js +529 -0
- package/lib/generators/modules/GenerateModuleObjCpp/serializeMethod.js.flow +510 -0
- package/lib/generators/modules/GenerateModuleObjCpp/source/serializeModule.js +96 -0
- package/lib/generators/modules/GenerateModuleObjCpp/source/serializeModule.js.flow +121 -0
- package/lib/generators/modules/Utils.js +34 -0
- package/lib/generators/modules/Utils.js.flow +53 -0
- package/lib/generators/modules/__test_fixtures__/fixtures.js +1658 -0
- package/lib/generators/modules/__test_fixtures__/fixtures.js.flow +1669 -0
- package/lib/parsers/consistency/compareSnaps.js +84 -0
- package/lib/parsers/error-utils.js +284 -0
- package/lib/parsers/error-utils.js.flow +295 -0
- package/lib/parsers/errors.js +350 -0
- package/lib/parsers/errors.js.flow +439 -0
- package/lib/parsers/flow/components/__test_fixtures__/failures.js +583 -0
- package/lib/parsers/flow/components/__test_fixtures__/failures.js.flow +600 -0
- package/lib/parsers/flow/components/__test_fixtures__/fixtures.js +1001 -0
- package/lib/parsers/flow/components/__test_fixtures__/fixtures.js.flow +1016 -0
- package/lib/parsers/flow/components/commands.js +104 -0
- package/lib/parsers/flow/components/commands.js.flow +123 -0
- package/lib/parsers/flow/components/componentsUtils.js +446 -0
- package/lib/parsers/flow/components/componentsUtils.js.flow +496 -0
- package/lib/parsers/flow/components/events.js +233 -0
- package/lib/parsers/flow/components/events.js.flow +262 -0
- package/lib/parsers/flow/components/extends.js +52 -0
- package/lib/parsers/flow/components/extends.js.flow +66 -0
- package/lib/parsers/flow/components/index.js +267 -0
- package/lib/parsers/flow/components/index.js.flow +226 -0
- package/lib/parsers/flow/components/options.js +72 -0
- package/lib/parsers/flow/components/options.js.flow +87 -0
- package/lib/parsers/flow/components/props.js +47 -0
- package/lib/parsers/flow/components/props.js.flow +60 -0
- package/lib/parsers/flow/components/schema.js +106 -0
- package/lib/parsers/flow/components/schema.js.flow +62 -0
- package/lib/parsers/flow/index.js +80 -0
- package/lib/parsers/flow/index.js.flow +85 -0
- package/lib/parsers/flow/modules/__test_fixtures__/failures.js +215 -0
- package/lib/parsers/flow/modules/__test_fixtures__/failures.js.flow +223 -0
- package/lib/parsers/flow/modules/__test_fixtures__/fixtures.js +724 -0
- package/lib/parsers/flow/modules/__test_fixtures__/fixtures.js.flow +747 -0
- package/lib/parsers/flow/modules/index.js +528 -0
- package/lib/parsers/flow/modules/index.js.flow +420 -0
- package/lib/parsers/flow/parser.js +109 -0
- package/lib/parsers/flow/parser.js.flow +83 -0
- package/lib/parsers/flow/utils.js +108 -0
- package/lib/parsers/flow/utils.js.flow +123 -0
- package/lib/parsers/parser.js +11 -0
- package/lib/parsers/parser.js.flow +70 -0
- package/lib/parsers/parserMock.js +96 -0
- package/lib/parsers/parserMock.js.flow +68 -0
- package/lib/parsers/parsers-commons.js +448 -0
- package/lib/parsers/parsers-commons.js.flow +447 -0
- package/lib/parsers/parsers-primitives.js +387 -0
- package/lib/parsers/parsers-primitives.js.flow +383 -0
- package/lib/parsers/parsers-utils.js +18 -0
- package/lib/parsers/parsers-utils.js.flow +19 -0
- package/lib/parsers/schema/index.js +23 -0
- package/lib/parsers/schema/index.js.flow +26 -0
- package/lib/parsers/typescript/components/__test_fixtures__/failures.js +489 -0
- package/lib/parsers/typescript/components/__test_fixtures__/failures.js.flow +505 -0
- package/lib/parsers/typescript/components/__test_fixtures__/fixtures.js +1151 -0
- package/lib/parsers/typescript/components/__test_fixtures__/fixtures.js.flow +1168 -0
- package/lib/parsers/typescript/components/commands.js +132 -0
- package/lib/parsers/typescript/components/commands.js.flow +151 -0
- package/lib/parsers/typescript/components/componentsUtils.js +471 -0
- package/lib/parsers/typescript/components/componentsUtils.js.flow +521 -0
- package/lib/parsers/typescript/components/events.js +240 -0
- package/lib/parsers/typescript/components/events.js.flow +262 -0
- package/lib/parsers/typescript/components/extends.js +88 -0
- package/lib/parsers/typescript/components/extends.js.flow +103 -0
- package/lib/parsers/typescript/components/index.js +277 -0
- package/lib/parsers/typescript/components/index.js.flow +239 -0
- package/lib/parsers/typescript/components/options.js +72 -0
- package/lib/parsers/typescript/components/options.js.flow +87 -0
- package/lib/parsers/typescript/components/props.js +39 -0
- package/lib/parsers/typescript/components/props.js.flow +48 -0
- package/lib/parsers/typescript/components/schema.js +106 -0
- package/lib/parsers/typescript/components/schema.js.flow +62 -0
- package/lib/parsers/typescript/index.js +85 -0
- package/lib/parsers/typescript/index.js.flow +94 -0
- package/lib/parsers/typescript/modules/__test_fixtures__/failures.js +160 -0
- package/lib/parsers/typescript/modules/__test_fixtures__/failures.js.flow +167 -0
- package/lib/parsers/typescript/modules/__test_fixtures__/fixtures.js +701 -0
- package/lib/parsers/typescript/modules/__test_fixtures__/fixtures.js.flow +727 -0
- package/lib/parsers/typescript/modules/index.js +543 -0
- package/lib/parsers/typescript/modules/index.js.flow +435 -0
- package/lib/parsers/typescript/parseTopLevelType.js +203 -0
- package/lib/parsers/typescript/parseTopLevelType.js.flow +243 -0
- package/lib/parsers/typescript/parser.js +105 -0
- package/lib/parsers/typescript/parser.js.flow +87 -0
- package/lib/parsers/typescript/utils.js +101 -0
- package/lib/parsers/typescript/utils.js.flow +115 -0
- package/lib/parsers/utils.js +273 -0
- package/lib/parsers/utils.js.flow +266 -0
- package/package.json +45 -0
|
@@ -0,0 +1,600 @@
|
|
|
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
|
+
* @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
|
+
|
|
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
|
+
* @flow strict-local
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
'use strict';
|
|
63
|
+
|
|
64
|
+
const codegenNativeCommands = require('codegenNativeCommands');
|
|
65
|
+
const codegenNativeComponent = require('codegenNativeComponent');
|
|
66
|
+
|
|
67
|
+
import type {Int32} from 'CodegenTypes';
|
|
68
|
+
import type {ViewProps} from 'ViewPropTypes';
|
|
69
|
+
import type {HostComponent} from 'react-native';
|
|
70
|
+
|
|
71
|
+
interface NativeCommands {
|
|
72
|
+
+hotspotUpdate: (viewRef: React.Ref<'RCTView'>, x: Int32, y: Int32) => void;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export type ModuleProps = $ReadOnly<{|
|
|
76
|
+
...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
|
+
): 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
|
+
* @flow strict-local
|
|
101
|
+
*/
|
|
102
|
+
|
|
103
|
+
'use strict';
|
|
104
|
+
|
|
105
|
+
const codegenNativeCommands = require('codegenNativeCommands');
|
|
106
|
+
const codegenNativeComponent = require('codegenNativeComponent');
|
|
107
|
+
|
|
108
|
+
import type {Int32} from 'CodegenTypes';
|
|
109
|
+
import type {ViewProps} from 'ViewPropTypes';
|
|
110
|
+
import type {HostComponent} from 'react-native';
|
|
111
|
+
|
|
112
|
+
interface NativeCommands {
|
|
113
|
+
+hotspotUpdate: (x: Int32, y: Int32) => void;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export type ModuleProps = $ReadOnly<{|
|
|
117
|
+
...ViewProps,
|
|
118
|
+
// No props or events
|
|
119
|
+
|}>;
|
|
120
|
+
|
|
121
|
+
export const Commands = codegenNativeCommands<NativeCommands>({
|
|
122
|
+
supportedCommands: ['hotspotUpdate'],
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
export default (codegenNativeComponent<ModuleProps>(
|
|
126
|
+
'Module',
|
|
127
|
+
): HostComponent<ModuleProps>);
|
|
128
|
+
`;
|
|
129
|
+
|
|
130
|
+
const COMMANDS_DEFINED_WITH_NULLABLE_REF = `
|
|
131
|
+
/**
|
|
132
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
133
|
+
*
|
|
134
|
+
* This source code is licensed under the MIT license found in the
|
|
135
|
+
* LICENSE file in the root directory of this source tree.
|
|
136
|
+
*
|
|
137
|
+
* @format
|
|
138
|
+
* @flow strict-local
|
|
139
|
+
*/
|
|
140
|
+
|
|
141
|
+
'use strict';
|
|
142
|
+
|
|
143
|
+
const codegenNativeCommands = require('codegenNativeCommands');
|
|
144
|
+
const codegenNativeComponent = require('codegenNativeComponent');
|
|
145
|
+
|
|
146
|
+
import type {Int32} from 'CodegenTypes';
|
|
147
|
+
import type {ViewProps} from 'ViewPropTypes';
|
|
148
|
+
import type {HostComponent} from 'react-native';
|
|
149
|
+
|
|
150
|
+
interface NativeCommands {
|
|
151
|
+
+hotspotUpdate: (viewRef: ?React.Ref<'RCTView'>, x: Int32, y: Int32) => void;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export type ModuleProps = $ReadOnly<{|
|
|
155
|
+
...ViewProps,
|
|
156
|
+
// No props or events
|
|
157
|
+
|}>;
|
|
158
|
+
|
|
159
|
+
export const Commands = codegenNativeCommands<NativeCommands>({
|
|
160
|
+
supportedCommands: ['hotspotUpdate'],
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
export default (codegenNativeComponent<ModuleProps>(
|
|
164
|
+
'Module',
|
|
165
|
+
): HostComponent<ModuleProps>);
|
|
166
|
+
`;
|
|
167
|
+
|
|
168
|
+
const COMMANDS_DEFINED_WITH_MISMATCHED_METHOD_NAMES = `
|
|
169
|
+
/**
|
|
170
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
171
|
+
*
|
|
172
|
+
* This source code is licensed under the MIT license found in the
|
|
173
|
+
* LICENSE file in the root directory of this source tree.
|
|
174
|
+
*
|
|
175
|
+
* @format
|
|
176
|
+
* @flow strict-local
|
|
177
|
+
*/
|
|
178
|
+
|
|
179
|
+
'use strict';
|
|
180
|
+
|
|
181
|
+
const codegenNativeCommands = require('codegenNativeCommands');
|
|
182
|
+
const codegenNativeComponent = require('codegenNativeComponent');
|
|
183
|
+
|
|
184
|
+
import type {Int32} from 'CodegenTypes';
|
|
185
|
+
import type {ViewProps} from 'ViewPropTypes';
|
|
186
|
+
import type {HostComponent} from 'react-native';
|
|
187
|
+
|
|
188
|
+
interface NativeCommands {
|
|
189
|
+
+hotspotUpdate: (viewRef: React.Ref<'RCTView'>, x: Int32, y: Int32) => void;
|
|
190
|
+
+scrollTo: (
|
|
191
|
+
viewRef: React.Ref<'RCTView'>,
|
|
192
|
+
y: Int32,
|
|
193
|
+
animated: boolean,
|
|
194
|
+
) => void;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export type ModuleProps = $ReadOnly<{|
|
|
198
|
+
...ViewProps,
|
|
199
|
+
// No props or events
|
|
200
|
+
|}>;
|
|
201
|
+
|
|
202
|
+
export const Commands = codegenNativeCommands<NativeCommands>({
|
|
203
|
+
supportedCommands: ['scrollTo'],
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
export default (codegenNativeComponent<ModuleProps>(
|
|
207
|
+
'Module',
|
|
208
|
+
): HostComponent<ModuleProps>);
|
|
209
|
+
`;
|
|
210
|
+
|
|
211
|
+
const COMMANDS_DEFINED_WITHOUT_METHOD_NAMES = `
|
|
212
|
+
/**
|
|
213
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
214
|
+
*
|
|
215
|
+
* This source code is licensed under the MIT license found in the
|
|
216
|
+
* LICENSE file in the root directory of this source tree.
|
|
217
|
+
*
|
|
218
|
+
* @format
|
|
219
|
+
* @flow strict-local
|
|
220
|
+
*/
|
|
221
|
+
|
|
222
|
+
'use strict';
|
|
223
|
+
|
|
224
|
+
const codegenNativeCommands = require('codegenNativeCommands');
|
|
225
|
+
const codegenNativeComponent = require('codegenNativeComponent');
|
|
226
|
+
|
|
227
|
+
import type {Int32} from 'CodegenTypes';
|
|
228
|
+
import type {ViewProps} from 'ViewPropTypes';
|
|
229
|
+
import type {HostComponent} from 'react-native';
|
|
230
|
+
|
|
231
|
+
interface NativeCommands {
|
|
232
|
+
+hotspotUpdate: (viewRef: React.Ref<'RCTView'>, x: Int32, y: Int32) => void;
|
|
233
|
+
+scrollTo: (
|
|
234
|
+
viewRef: React.Ref<'RCTView'>,
|
|
235
|
+
y: Int32,
|
|
236
|
+
animated: boolean,
|
|
237
|
+
) => void;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export type ModuleProps = $ReadOnly<{|
|
|
241
|
+
...ViewProps,
|
|
242
|
+
// No props or events
|
|
243
|
+
|}>;
|
|
244
|
+
|
|
245
|
+
export const Commands = codegenNativeCommands<NativeCommands>();
|
|
246
|
+
|
|
247
|
+
export default (codegenNativeComponent<ModuleProps>(
|
|
248
|
+
'Module',
|
|
249
|
+
): HostComponent<ModuleProps>);
|
|
250
|
+
`;
|
|
251
|
+
|
|
252
|
+
const NULLABLE_WITH_DEFAULT = `
|
|
253
|
+
/**
|
|
254
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
255
|
+
*
|
|
256
|
+
* This source code is licensed under the MIT license found in the
|
|
257
|
+
* LICENSE file in the root directory of this source tree.
|
|
258
|
+
*
|
|
259
|
+
* @format
|
|
260
|
+
* @flow strict-local
|
|
261
|
+
*/
|
|
262
|
+
|
|
263
|
+
'use strict';
|
|
264
|
+
|
|
265
|
+
const codegenNativeComponent = require('codegenNativeComponent');
|
|
266
|
+
|
|
267
|
+
import type {WithDefault, Float} from 'CodegenTypes';
|
|
268
|
+
import type {ViewProps} from 'ViewPropTypes';
|
|
269
|
+
import type {HostComponent} from 'react-native';
|
|
270
|
+
|
|
271
|
+
export type ModuleProps = $ReadOnly<{|
|
|
272
|
+
...ViewProps,
|
|
273
|
+
nullable_with_default: ?WithDefault<Float, 1.0>,
|
|
274
|
+
|}>;
|
|
275
|
+
|
|
276
|
+
export default (codegenNativeComponent<ModuleProps>(
|
|
277
|
+
'Module',
|
|
278
|
+
): HostComponent<ModuleProps>);
|
|
279
|
+
`;
|
|
280
|
+
|
|
281
|
+
const NON_OPTIONAL_KEY_WITH_DEFAULT_VALUE = `
|
|
282
|
+
/**
|
|
283
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
284
|
+
*
|
|
285
|
+
* This source code is licensed under the MIT license found in the
|
|
286
|
+
* LICENSE file in the root directory of this source tree.
|
|
287
|
+
*
|
|
288
|
+
* @format
|
|
289
|
+
* @flow strict-local
|
|
290
|
+
*/
|
|
291
|
+
|
|
292
|
+
'use strict';
|
|
293
|
+
|
|
294
|
+
const codegenNativeComponent = require('codegenNativeComponent');
|
|
295
|
+
|
|
296
|
+
import type {WithDefault, Float} from 'CodegenTypes';
|
|
297
|
+
import type {ViewProps} from 'ViewPropTypes';
|
|
298
|
+
import type {HostComponent} from 'react-native';
|
|
299
|
+
|
|
300
|
+
export type ModuleProps = $ReadOnly<{|
|
|
301
|
+
...ViewProps,
|
|
302
|
+
required_key_with_default: WithDefault<Float, 1.0>,
|
|
303
|
+
|}>;
|
|
304
|
+
|
|
305
|
+
export default (codegenNativeComponent<ModuleProps>(
|
|
306
|
+
'Module',
|
|
307
|
+
): HostComponent<ModuleProps>);
|
|
308
|
+
`;
|
|
309
|
+
|
|
310
|
+
const PROPS_CONFLICT_NAMES = `
|
|
311
|
+
/**
|
|
312
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
313
|
+
*
|
|
314
|
+
* This source code is licensed under the MIT license found in the
|
|
315
|
+
* LICENSE file in the root directory of this source tree.
|
|
316
|
+
*
|
|
317
|
+
* @format
|
|
318
|
+
* @flow strict-local
|
|
319
|
+
*/
|
|
320
|
+
|
|
321
|
+
'use strict';
|
|
322
|
+
|
|
323
|
+
import type {ViewProps} from 'ViewPropTypes';
|
|
324
|
+
import type {HostComponent} from 'react-native';
|
|
325
|
+
|
|
326
|
+
const codegenNativeComponent = require('codegenNativeComponent');
|
|
327
|
+
|
|
328
|
+
export type ModuleProps = $ReadOnly<{|
|
|
329
|
+
...ViewProps,
|
|
330
|
+
isEnabled: string,
|
|
331
|
+
|
|
332
|
+
isEnabled: boolean,
|
|
333
|
+
|}>;
|
|
334
|
+
|
|
335
|
+
export default (codegenNativeComponent<ModuleProps>(
|
|
336
|
+
'Module',
|
|
337
|
+
): HostComponent<ModuleProps>);
|
|
338
|
+
`;
|
|
339
|
+
|
|
340
|
+
const PROPS_CONFLICT_WITH_SPREAD_PROPS = `
|
|
341
|
+
/**
|
|
342
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
343
|
+
*
|
|
344
|
+
* This source code is licensed under the MIT license found in the
|
|
345
|
+
* LICENSE file in the root directory of this source tree.
|
|
346
|
+
*
|
|
347
|
+
* @format
|
|
348
|
+
* @flow strict-local
|
|
349
|
+
*/
|
|
350
|
+
|
|
351
|
+
'use strict';
|
|
352
|
+
|
|
353
|
+
import type {ViewProps} from 'ViewPropTypes';
|
|
354
|
+
import type {HostComponent} from 'react-native';
|
|
355
|
+
|
|
356
|
+
const codegenNativeComponent = require('codegenNativeComponent');
|
|
357
|
+
|
|
358
|
+
type PropsInFile = $ReadOnly<{|
|
|
359
|
+
isEnabled: boolean,
|
|
360
|
+
|}>;
|
|
361
|
+
|
|
362
|
+
export type ModuleProps = $ReadOnly<{|
|
|
363
|
+
...ViewProps,
|
|
364
|
+
|
|
365
|
+
...PropsInFile,
|
|
366
|
+
isEnabled: boolean,
|
|
367
|
+
|}>;
|
|
368
|
+
|
|
369
|
+
export default (codegenNativeComponent<ModuleProps>(
|
|
370
|
+
'Module',
|
|
371
|
+
): HostComponent<ModuleProps>);
|
|
372
|
+
`;
|
|
373
|
+
|
|
374
|
+
const PROPS_SPREAD_CONFLICTS_WITH_PROPS = `
|
|
375
|
+
/**
|
|
376
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
377
|
+
*
|
|
378
|
+
* This source code is licensed under the MIT license found in the
|
|
379
|
+
* LICENSE file in the root directory of this source tree.
|
|
380
|
+
*
|
|
381
|
+
* @format
|
|
382
|
+
* @flow strict-local
|
|
383
|
+
*/
|
|
384
|
+
|
|
385
|
+
'use strict';
|
|
386
|
+
|
|
387
|
+
import type {ViewProps} from 'ViewPropTypes';
|
|
388
|
+
import type {HostComponent} from 'react-native';
|
|
389
|
+
|
|
390
|
+
const codegenNativeComponent = require('codegenNativeComponent');
|
|
391
|
+
|
|
392
|
+
type PropsInFile = $ReadOnly<{|
|
|
393
|
+
isEnabled: boolean,
|
|
394
|
+
|}>;
|
|
395
|
+
|
|
396
|
+
export type ModuleProps = $ReadOnly<{|
|
|
397
|
+
...ViewProps,
|
|
398
|
+
|
|
399
|
+
isEnabled: boolean,
|
|
400
|
+
...PropsInFile,
|
|
401
|
+
|}>;
|
|
402
|
+
|
|
403
|
+
export default (codegenNativeComponent<ModuleProps>(
|
|
404
|
+
'Module',
|
|
405
|
+
): HostComponent<ModuleProps>);
|
|
406
|
+
`;
|
|
407
|
+
|
|
408
|
+
const PROP_NUMBER_TYPE = `
|
|
409
|
+
/**
|
|
410
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
411
|
+
*
|
|
412
|
+
* This source code is licensed under the MIT license found in the
|
|
413
|
+
* LICENSE file in the root directory of this source tree.
|
|
414
|
+
*
|
|
415
|
+
* @format
|
|
416
|
+
* @flow strict-local
|
|
417
|
+
*/
|
|
418
|
+
|
|
419
|
+
'use strict';
|
|
420
|
+
|
|
421
|
+
import type {ViewProps} from 'ViewPropTypes';
|
|
422
|
+
import type {HostComponent} from 'react-native';
|
|
423
|
+
|
|
424
|
+
const codegenNativeComponent = require('codegenNativeComponent');
|
|
425
|
+
|
|
426
|
+
export type ModuleProps = $ReadOnly<{|
|
|
427
|
+
...ViewProps,
|
|
428
|
+
|
|
429
|
+
someProp: number
|
|
430
|
+
|}>;
|
|
431
|
+
|
|
432
|
+
export default (codegenNativeComponent<ModuleProps>(
|
|
433
|
+
'Module',
|
|
434
|
+
): HostComponent<ModuleProps>);
|
|
435
|
+
`;
|
|
436
|
+
|
|
437
|
+
const PROP_MIXED_ENUM = `
|
|
438
|
+
/**
|
|
439
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
440
|
+
*
|
|
441
|
+
* This source code is licensed under the MIT license found in the
|
|
442
|
+
* LICENSE file in the root directory of this source tree.
|
|
443
|
+
*
|
|
444
|
+
* @format
|
|
445
|
+
* @flow strict-local
|
|
446
|
+
*/
|
|
447
|
+
|
|
448
|
+
'use strict';
|
|
449
|
+
|
|
450
|
+
import type {ViewProps} from 'ViewPropTypes';
|
|
451
|
+
import type {HostComponent} from 'react-native';
|
|
452
|
+
|
|
453
|
+
const codegenNativeComponent = require('codegenNativeComponent');
|
|
454
|
+
|
|
455
|
+
export type ModuleProps = $ReadOnly<{|
|
|
456
|
+
...ViewProps,
|
|
457
|
+
|
|
458
|
+
someProp?: WithDefault<'foo' | 1, 1>
|
|
459
|
+
|}>;
|
|
460
|
+
|
|
461
|
+
export default (codegenNativeComponent<ModuleProps>(
|
|
462
|
+
'Module',
|
|
463
|
+
): HostComponent<ModuleProps>);
|
|
464
|
+
`;
|
|
465
|
+
|
|
466
|
+
const PROP_ENUM_BOOLEAN = `
|
|
467
|
+
/**
|
|
468
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
469
|
+
*
|
|
470
|
+
* This source code is licensed under the MIT license found in the
|
|
471
|
+
* LICENSE file in the root directory of this source tree.
|
|
472
|
+
*
|
|
473
|
+
* @format
|
|
474
|
+
* @flow strict-local
|
|
475
|
+
*/
|
|
476
|
+
|
|
477
|
+
'use strict';
|
|
478
|
+
|
|
479
|
+
import type {ViewProps} from 'ViewPropTypes';
|
|
480
|
+
import type {HostComponent} from 'react-native';
|
|
481
|
+
|
|
482
|
+
const codegenNativeComponent = require('codegenNativeComponent');
|
|
483
|
+
|
|
484
|
+
export type ModuleProps = $ReadOnly<{|
|
|
485
|
+
...ViewProps,
|
|
486
|
+
|
|
487
|
+
someProp?: WithDefault<false | true, false>
|
|
488
|
+
|}>;
|
|
489
|
+
|
|
490
|
+
export default (codegenNativeComponent<ModuleProps>(
|
|
491
|
+
'Module',
|
|
492
|
+
): HostComponent<ModuleProps>);
|
|
493
|
+
`;
|
|
494
|
+
|
|
495
|
+
const PROP_ARRAY_MIXED_ENUM = `
|
|
496
|
+
/**
|
|
497
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
498
|
+
*
|
|
499
|
+
* This source code is licensed under the MIT license found in the
|
|
500
|
+
* LICENSE file in the root directory of this source tree.
|
|
501
|
+
*
|
|
502
|
+
* @format
|
|
503
|
+
* @flow strict-local
|
|
504
|
+
*/
|
|
505
|
+
|
|
506
|
+
'use strict';
|
|
507
|
+
|
|
508
|
+
import type {ViewProps} from 'ViewPropTypes';
|
|
509
|
+
import type {HostComponent} from 'react-native';
|
|
510
|
+
|
|
511
|
+
const codegenNativeComponent = require('codegenNativeComponent');
|
|
512
|
+
|
|
513
|
+
export type ModuleProps = $ReadOnly<{|
|
|
514
|
+
...ViewProps,
|
|
515
|
+
|
|
516
|
+
someProp?: WithDefault<$ReadOnlyArray<'foo' | 1>, 1>
|
|
517
|
+
|}>;
|
|
518
|
+
|
|
519
|
+
export default (codegenNativeComponent<ModuleProps>(
|
|
520
|
+
'Module',
|
|
521
|
+
): HostComponent<ModuleProps>);
|
|
522
|
+
`;
|
|
523
|
+
|
|
524
|
+
const PROP_ARRAY_ENUM_BOOLEAN = `
|
|
525
|
+
/**
|
|
526
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
527
|
+
*
|
|
528
|
+
* This source code is licensed under the MIT license found in the
|
|
529
|
+
* LICENSE file in the root directory of this source tree.
|
|
530
|
+
*
|
|
531
|
+
* @format
|
|
532
|
+
* @flow strict-local
|
|
533
|
+
*/
|
|
534
|
+
|
|
535
|
+
'use strict';
|
|
536
|
+
|
|
537
|
+
import type {ViewProps} from 'ViewPropTypes';
|
|
538
|
+
import type {HostComponent} from 'react-native';
|
|
539
|
+
|
|
540
|
+
const codegenNativeComponent = require('codegenNativeComponent');
|
|
541
|
+
|
|
542
|
+
export type ModuleProps = $ReadOnly<{|
|
|
543
|
+
...ViewProps,
|
|
544
|
+
|
|
545
|
+
someProp?: WithDefault<$ReadOnlyArray<false | true>, false>
|
|
546
|
+
|}>;
|
|
547
|
+
|
|
548
|
+
export default (codegenNativeComponent<ModuleProps>(
|
|
549
|
+
'Module',
|
|
550
|
+
): HostComponent<ModuleProps>);
|
|
551
|
+
`;
|
|
552
|
+
|
|
553
|
+
const PROP_ARRAY_ENUM_INT = `
|
|
554
|
+
/**
|
|
555
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
556
|
+
*
|
|
557
|
+
* This source code is licensed under the MIT license found in the
|
|
558
|
+
* LICENSE file in the root directory of this source tree.
|
|
559
|
+
*
|
|
560
|
+
* @format
|
|
561
|
+
* @flow strict-local
|
|
562
|
+
*/
|
|
563
|
+
|
|
564
|
+
'use strict';
|
|
565
|
+
|
|
566
|
+
import type {ViewProps} from 'ViewPropTypes';
|
|
567
|
+
import type {HostComponent} from 'react-native';
|
|
568
|
+
|
|
569
|
+
const codegenNativeComponent = require('codegenNativeComponent');
|
|
570
|
+
|
|
571
|
+
export type ModuleProps = $ReadOnly<{|
|
|
572
|
+
...ViewProps,
|
|
573
|
+
|
|
574
|
+
someProp?: WithDefault<$ReadOnlyArray<0 | 1>, 0>
|
|
575
|
+
|}>;
|
|
576
|
+
|
|
577
|
+
export default (codegenNativeComponent<ModuleProps>(
|
|
578
|
+
'Module',
|
|
579
|
+
): HostComponent<ModuleProps>);
|
|
580
|
+
`;
|
|
581
|
+
|
|
582
|
+
module.exports = {
|
|
583
|
+
COMMANDS_DEFINED_INLINE,
|
|
584
|
+
COMMANDS_DEFINED_MULTIPLE_TIMES,
|
|
585
|
+
COMMANDS_DEFINED_WITH_MISMATCHED_METHOD_NAMES,
|
|
586
|
+
COMMANDS_DEFINED_WITHOUT_METHOD_NAMES,
|
|
587
|
+
COMMANDS_DEFINED_WITHOUT_REF,
|
|
588
|
+
COMMANDS_DEFINED_WITH_NULLABLE_REF,
|
|
589
|
+
NULLABLE_WITH_DEFAULT,
|
|
590
|
+
NON_OPTIONAL_KEY_WITH_DEFAULT_VALUE,
|
|
591
|
+
PROPS_CONFLICT_NAMES,
|
|
592
|
+
PROPS_CONFLICT_WITH_SPREAD_PROPS,
|
|
593
|
+
PROPS_SPREAD_CONFLICTS_WITH_PROPS,
|
|
594
|
+
PROP_NUMBER_TYPE,
|
|
595
|
+
PROP_MIXED_ENUM,
|
|
596
|
+
PROP_ENUM_BOOLEAN,
|
|
597
|
+
PROP_ARRAY_MIXED_ENUM,
|
|
598
|
+
PROP_ARRAY_ENUM_BOOLEAN,
|
|
599
|
+
PROP_ARRAY_ENUM_INT,
|
|
600
|
+
};
|