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