@react-native/codegen 0.82.0-nightly-20250807-2768c8444 → 0.82.0-nightly-20250809-e0ea78190
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/lib/cli/generators/generate-all.js +3 -0
- package/lib/cli/generators/generate-all.js.flow +10 -2
- package/lib/generators/RNCodegen.js +2 -0
- package/lib/generators/RNCodegen.js.flow +4 -0
- package/lib/generators/components/CppHelpers.js +1 -1
- package/lib/generators/components/CppHelpers.js.flow +1 -1
- package/lib/generators/components/GenerateComponentDescriptorCpp.js +1 -0
- package/lib/generators/components/GenerateComponentDescriptorCpp.js.flow +1 -0
- package/lib/generators/components/GenerateComponentDescriptorH.js +1 -0
- package/lib/generators/components/GenerateComponentDescriptorH.js.flow +1 -0
- package/lib/generators/components/GenerateComponentHObjCpp.js +1 -0
- package/lib/generators/components/GenerateComponentHObjCpp.js.flow +1 -0
- package/lib/generators/components/GenerateEventEmitterCpp.js +1 -0
- package/lib/generators/components/GenerateEventEmitterCpp.js.flow +1 -0
- package/lib/generators/components/GenerateEventEmitterH.js +1 -0
- package/lib/generators/components/GenerateEventEmitterH.js.flow +1 -0
- package/lib/generators/components/GeneratePropsCpp.js +40 -2
- package/lib/generators/components/GeneratePropsCpp.js.flow +43 -1
- package/lib/generators/components/GeneratePropsH.js +19 -2
- package/lib/generators/components/GeneratePropsH.js.flow +15 -2
- package/lib/generators/components/GeneratePropsJavaDelegate.js +1 -0
- package/lib/generators/components/GeneratePropsJavaDelegate.js.flow +1 -0
- package/lib/generators/components/GeneratePropsJavaInterface.js +1 -0
- package/lib/generators/components/GeneratePropsJavaInterface.js.flow +1 -0
- package/lib/generators/components/GenerateShadowNodeCpp.js +1 -0
- package/lib/generators/components/GenerateShadowNodeCpp.js.flow +1 -0
- package/lib/generators/components/GenerateShadowNodeH.js +1 -0
- package/lib/generators/components/GenerateShadowNodeH.js.flow +1 -0
- package/lib/generators/components/GenerateStateCpp.js +1 -0
- package/lib/generators/components/GenerateStateCpp.js.flow +1 -0
- package/lib/generators/components/GenerateStateH.js +1 -0
- package/lib/generators/components/GenerateStateH.js.flow +1 -0
- package/package.json +1 -1
|
@@ -40,6 +40,8 @@ try {
|
|
|
40
40
|
} catch (err) {
|
|
41
41
|
throw new Error(`Can't parse schema to JSON. ${schemaPath}`);
|
|
42
42
|
}
|
|
43
|
+
const includeGetDebugPropsImplementation =
|
|
44
|
+
libraryName.includes('FBReactNativeSpec');
|
|
43
45
|
RNCodegen.generate(
|
|
44
46
|
{
|
|
45
47
|
libraryName,
|
|
@@ -47,6 +49,7 @@ RNCodegen.generate(
|
|
|
47
49
|
outputDirectory,
|
|
48
50
|
packageName,
|
|
49
51
|
assumeNonnull,
|
|
52
|
+
includeGetDebugPropsImplementation,
|
|
50
53
|
},
|
|
51
54
|
{
|
|
52
55
|
generators: [
|
|
@@ -46,9 +46,17 @@ try {
|
|
|
46
46
|
} catch (err) {
|
|
47
47
|
throw new Error(`Can't parse schema to JSON. ${schemaPath}`);
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
const includeGetDebugPropsImplementation: boolean =
|
|
50
|
+
libraryName.includes('FBReactNativeSpec');
|
|
50
51
|
RNCodegen.generate(
|
|
51
|
-
{
|
|
52
|
+
{
|
|
53
|
+
libraryName,
|
|
54
|
+
schema,
|
|
55
|
+
outputDirectory,
|
|
56
|
+
packageName,
|
|
57
|
+
assumeNonnull,
|
|
58
|
+
includeGetDebugPropsImplementation,
|
|
59
|
+
},
|
|
52
60
|
{
|
|
53
61
|
generators: [
|
|
54
62
|
'descriptors',
|
|
@@ -178,6 +178,7 @@ module.exports = {
|
|
|
178
178
|
packageName,
|
|
179
179
|
assumeNonnull,
|
|
180
180
|
useLocalIncludePaths,
|
|
181
|
+
includeGetDebugPropsImplementation = false,
|
|
181
182
|
libraryGenerators = LIBRARY_GENERATORS,
|
|
182
183
|
},
|
|
183
184
|
{generators, test},
|
|
@@ -217,6 +218,7 @@ module.exports = {
|
|
|
217
218
|
packageName,
|
|
218
219
|
assumeNonnull,
|
|
219
220
|
headerPrefix,
|
|
221
|
+
includeGetDebugPropsImplementation,
|
|
220
222
|
).forEach((contents, fileName) => {
|
|
221
223
|
generatedFiles.push({
|
|
222
224
|
name: fileName,
|
|
@@ -81,6 +81,7 @@ export type GenerateFunction = (
|
|
|
81
81
|
packageName?: string,
|
|
82
82
|
assumeNonnull: boolean,
|
|
83
83
|
headerPrefix?: string,
|
|
84
|
+
includeGetDebugPropsImplementation?: boolean,
|
|
84
85
|
) => FilesOutput;
|
|
85
86
|
|
|
86
87
|
export type LibraryGeneratorsFunctions = $ReadOnly<{
|
|
@@ -94,6 +95,7 @@ export type LibraryOptions = $ReadOnly<{
|
|
|
94
95
|
packageName?: string, // Some platforms have a notion of package, which should be configurable.
|
|
95
96
|
assumeNonnull: boolean,
|
|
96
97
|
useLocalIncludePaths?: boolean,
|
|
98
|
+
includeGetDebugPropsImplementation?: boolean,
|
|
97
99
|
libraryGenerators?: LibraryGeneratorsFunctions,
|
|
98
100
|
}>;
|
|
99
101
|
|
|
@@ -255,6 +257,7 @@ module.exports = {
|
|
|
255
257
|
packageName,
|
|
256
258
|
assumeNonnull,
|
|
257
259
|
useLocalIncludePaths,
|
|
260
|
+
includeGetDebugPropsImplementation = false,
|
|
258
261
|
libraryGenerators = LIBRARY_GENERATORS,
|
|
259
262
|
}: LibraryOptions,
|
|
260
263
|
{generators, test}: LibraryConfig,
|
|
@@ -299,6 +302,7 @@ module.exports = {
|
|
|
299
302
|
packageName,
|
|
300
303
|
assumeNonnull,
|
|
301
304
|
headerPrefix,
|
|
305
|
+
includeGetDebugPropsImplementation,
|
|
302
306
|
).forEach((contents: string, fileName: string) => {
|
|
303
307
|
generatedFiles.push({
|
|
304
308
|
name: fileName,
|
|
@@ -129,7 +129,7 @@ function convertDefaultTypeToString(componentName, prop, fromBuilder = false) {
|
|
|
129
129
|
if (typeAnnotation.default == null) {
|
|
130
130
|
return '';
|
|
131
131
|
}
|
|
132
|
-
return `"${typeAnnotation.default}"`;
|
|
132
|
+
return `std::string{"${typeAnnotation.default}"}`;
|
|
133
133
|
case 'Int32TypeAnnotation':
|
|
134
134
|
return String(typeAnnotation.default);
|
|
135
135
|
case 'DoubleTypeAnnotation':
|
|
@@ -190,7 +190,7 @@ function convertDefaultTypeToString(
|
|
|
190
190
|
if (typeAnnotation.default == null) {
|
|
191
191
|
return '';
|
|
192
192
|
}
|
|
193
|
-
return `"${typeAnnotation.default}"`;
|
|
193
|
+
return `std::string{"${typeAnnotation.default}"}`;
|
|
194
194
|
case 'Int32TypeAnnotation':
|
|
195
195
|
return String(typeAnnotation.default);
|
|
196
196
|
case 'DoubleTypeAnnotation':
|
|
@@ -413,6 +413,7 @@ module.exports = {
|
|
|
413
413
|
packageName?: string,
|
|
414
414
|
assumeNonnull: boolean = false,
|
|
415
415
|
headerPrefix?: string,
|
|
416
|
+
includeGetDebugPropsImplementation?: boolean = false,
|
|
416
417
|
): FilesOutput {
|
|
417
418
|
const moduleComponents: ComponentCollection = Object.keys(schema.modules)
|
|
418
419
|
.map(moduleName => {
|
|
@@ -320,6 +320,7 @@ module.exports = {
|
|
|
320
320
|
packageName?: string,
|
|
321
321
|
assumeNonnull: boolean = false,
|
|
322
322
|
headerPrefix?: string,
|
|
323
|
+
includeGetDebugPropsImplementation?: boolean = false,
|
|
323
324
|
): FilesOutput {
|
|
324
325
|
const moduleComponents: ComponentCollection = Object.keys(schema.modules)
|
|
325
326
|
.map(moduleName => {
|
|
@@ -53,7 +53,13 @@ ${className}::${className}(
|
|
|
53
53
|
${diffProps}
|
|
54
54
|
|
|
55
55
|
`.trim();
|
|
56
|
-
function generatePropsDiffString(
|
|
56
|
+
function generatePropsDiffString(
|
|
57
|
+
className,
|
|
58
|
+
componentName,
|
|
59
|
+
component,
|
|
60
|
+
debugProps = '',
|
|
61
|
+
includeGetDebugPropsImplementation = false,
|
|
62
|
+
) {
|
|
57
63
|
const diffProps = component.props
|
|
58
64
|
.map(prop => {
|
|
59
65
|
const typeAnnotation = prop.typeAnnotation;
|
|
@@ -109,6 +115,11 @@ function generatePropsDiffString(className, componentName, component) {
|
|
|
109
115
|
}
|
|
110
116
|
})
|
|
111
117
|
.join('\n' + ' ');
|
|
118
|
+
const getDebugPropsString = `#if RN_DEBUG_STRING_CONVERTIBLE
|
|
119
|
+
SharedDebugStringConvertibleList ${className}::getDebugProps() const {
|
|
120
|
+
return ViewProps::getDebugProps()${debugProps && debugProps.length > 0 ? ` +\n\t\tSharedDebugStringConvertibleList{${debugProps}\n\t}` : ''};
|
|
121
|
+
}
|
|
122
|
+
#endif`;
|
|
112
123
|
return `
|
|
113
124
|
#ifdef RN_SERIALIZABLE_STATE
|
|
114
125
|
ComponentName ${className}::getDiffPropsImplementationTarget() const {
|
|
@@ -128,7 +139,9 @@ folly::dynamic ${className}::getDiffProps(
|
|
|
128
139
|
${diffProps}
|
|
129
140
|
return result;
|
|
130
141
|
}
|
|
131
|
-
#endif
|
|
142
|
+
#endif
|
|
143
|
+
${includeGetDebugPropsImplementation ? getDebugPropsString : ''}
|
|
144
|
+
`;
|
|
132
145
|
}
|
|
133
146
|
function generatePropsString(componentName, component) {
|
|
134
147
|
return component.props
|
|
@@ -144,6 +157,19 @@ function generatePropsString(componentName, component) {
|
|
|
144
157
|
})
|
|
145
158
|
.join(',\n' + ' ');
|
|
146
159
|
}
|
|
160
|
+
function generateDebugPropsString(componentName, component) {
|
|
161
|
+
return component.props
|
|
162
|
+
.map(prop => {
|
|
163
|
+
if (prop.typeAnnotation.type === 'ObjectTypeAnnotation') {
|
|
164
|
+
// Skip ObjectTypeAnnotation because there is no generic `toString`
|
|
165
|
+
// method for it. We would have to define an interface that the structs implement.
|
|
166
|
+
return '';
|
|
167
|
+
}
|
|
168
|
+
const defaultValue = convertDefaultTypeToString(componentName, prop);
|
|
169
|
+
return `\n\t\t\tdebugStringConvertibleItem("${prop.name}", ${prop.name}${defaultValue ? `, ${defaultValue}` : ''})`;
|
|
170
|
+
})
|
|
171
|
+
.join(',');
|
|
172
|
+
}
|
|
147
173
|
function getClassExtendString(component) {
|
|
148
174
|
const extendString =
|
|
149
175
|
' ' +
|
|
@@ -174,12 +200,19 @@ module.exports = {
|
|
|
174
200
|
packageName,
|
|
175
201
|
assumeNonnull = false,
|
|
176
202
|
headerPrefix,
|
|
203
|
+
includeGetDebugPropsImplementation = false,
|
|
177
204
|
) {
|
|
178
205
|
const fileName = 'Props.cpp';
|
|
179
206
|
const allImports = new Set([
|
|
180
207
|
'#include <react/renderer/core/propsConversions.h>',
|
|
181
208
|
'#include <react/renderer/core/PropsParserContext.h>',
|
|
182
209
|
]);
|
|
210
|
+
if (includeGetDebugPropsImplementation) {
|
|
211
|
+
allImports.add('#include <react/renderer/core/graphicsConversions.h>');
|
|
212
|
+
allImports.add(
|
|
213
|
+
'#include <react/renderer/debug/debugStringConvertibleUtils.h>',
|
|
214
|
+
);
|
|
215
|
+
}
|
|
183
216
|
const componentProps = Object.keys(schema.modules)
|
|
184
217
|
.map(moduleName => {
|
|
185
218
|
const module = schema.modules[moduleName];
|
|
@@ -197,10 +230,15 @@ module.exports = {
|
|
|
197
230
|
const newName = `${componentName}Props`;
|
|
198
231
|
const propsString = generatePropsString(componentName, component);
|
|
199
232
|
const extendString = getClassExtendString(component);
|
|
233
|
+
const debugProps = includeGetDebugPropsImplementation
|
|
234
|
+
? generateDebugPropsString(componentName, component)
|
|
235
|
+
: '';
|
|
200
236
|
const diffPropsString = generatePropsDiffString(
|
|
201
237
|
newName,
|
|
202
238
|
componentName,
|
|
203
239
|
component,
|
|
240
|
+
debugProps,
|
|
241
|
+
includeGetDebugPropsImplementation,
|
|
204
242
|
);
|
|
205
243
|
const imports = getImports(component.props);
|
|
206
244
|
// $FlowFixMe[method-unbinding] added when improving typing for this parameters
|
|
@@ -77,6 +77,8 @@ function generatePropsDiffString(
|
|
|
77
77
|
className: string,
|
|
78
78
|
componentName: string,
|
|
79
79
|
component: ComponentShape,
|
|
80
|
+
debugProps: string = '',
|
|
81
|
+
includeGetDebugPropsImplementation?: boolean = false,
|
|
80
82
|
) {
|
|
81
83
|
const diffProps = component.props
|
|
82
84
|
.map(prop => {
|
|
@@ -134,6 +136,12 @@ function generatePropsDiffString(
|
|
|
134
136
|
})
|
|
135
137
|
.join('\n' + ' ');
|
|
136
138
|
|
|
139
|
+
const getDebugPropsString = `#if RN_DEBUG_STRING_CONVERTIBLE
|
|
140
|
+
SharedDebugStringConvertibleList ${className}::getDebugProps() const {
|
|
141
|
+
return ViewProps::getDebugProps()${debugProps && debugProps.length > 0 ? ` +\n\t\tSharedDebugStringConvertibleList{${debugProps}\n\t}` : ''};
|
|
142
|
+
}
|
|
143
|
+
#endif`;
|
|
144
|
+
|
|
137
145
|
return `
|
|
138
146
|
#ifdef RN_SERIALIZABLE_STATE
|
|
139
147
|
ComponentName ${className}::getDiffPropsImplementationTarget() const {
|
|
@@ -153,8 +161,11 @@ folly::dynamic ${className}::getDiffProps(
|
|
|
153
161
|
${diffProps}
|
|
154
162
|
return result;
|
|
155
163
|
}
|
|
156
|
-
#endif
|
|
164
|
+
#endif
|
|
165
|
+
${includeGetDebugPropsImplementation ? getDebugPropsString : ''}
|
|
166
|
+
`;
|
|
157
167
|
}
|
|
168
|
+
|
|
158
169
|
function generatePropsString(componentName: string, component: ComponentShape) {
|
|
159
170
|
return component.props
|
|
160
171
|
.map(prop => {
|
|
@@ -170,6 +181,24 @@ function generatePropsString(componentName: string, component: ComponentShape) {
|
|
|
170
181
|
.join(',\n' + ' ');
|
|
171
182
|
}
|
|
172
183
|
|
|
184
|
+
function generateDebugPropsString(
|
|
185
|
+
componentName: string,
|
|
186
|
+
component: ComponentShape,
|
|
187
|
+
) {
|
|
188
|
+
return component.props
|
|
189
|
+
.map(prop => {
|
|
190
|
+
if (prop.typeAnnotation.type === 'ObjectTypeAnnotation') {
|
|
191
|
+
// Skip ObjectTypeAnnotation because there is no generic `toString`
|
|
192
|
+
// method for it. We would have to define an interface that the structs implement.
|
|
193
|
+
return '';
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const defaultValue = convertDefaultTypeToString(componentName, prop);
|
|
197
|
+
return `\n\t\t\tdebugStringConvertibleItem("${prop.name}", ${prop.name}${defaultValue ? `, ${defaultValue}` : ''})`;
|
|
198
|
+
})
|
|
199
|
+
.join(',');
|
|
200
|
+
}
|
|
201
|
+
|
|
173
202
|
function getClassExtendString(component: ComponentShape): string {
|
|
174
203
|
const extendString =
|
|
175
204
|
' ' +
|
|
@@ -202,6 +231,7 @@ module.exports = {
|
|
|
202
231
|
packageName?: string,
|
|
203
232
|
assumeNonnull: boolean = false,
|
|
204
233
|
headerPrefix?: string,
|
|
234
|
+
includeGetDebugPropsImplementation?: boolean = false,
|
|
205
235
|
): FilesOutput {
|
|
206
236
|
const fileName = 'Props.cpp';
|
|
207
237
|
const allImports: Set<string> = new Set([
|
|
@@ -209,6 +239,13 @@ module.exports = {
|
|
|
209
239
|
'#include <react/renderer/core/PropsParserContext.h>',
|
|
210
240
|
]);
|
|
211
241
|
|
|
242
|
+
if (includeGetDebugPropsImplementation) {
|
|
243
|
+
allImports.add('#include <react/renderer/core/graphicsConversions.h>');
|
|
244
|
+
allImports.add(
|
|
245
|
+
'#include <react/renderer/debug/debugStringConvertibleUtils.h>',
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
|
|
212
249
|
const componentProps = Object.keys(schema.modules)
|
|
213
250
|
.map(moduleName => {
|
|
214
251
|
const module = schema.modules[moduleName];
|
|
@@ -229,10 +266,15 @@ module.exports = {
|
|
|
229
266
|
|
|
230
267
|
const propsString = generatePropsString(componentName, component);
|
|
231
268
|
const extendString = getClassExtendString(component);
|
|
269
|
+
const debugProps = includeGetDebugPropsImplementation
|
|
270
|
+
? generateDebugPropsString(componentName, component)
|
|
271
|
+
: '';
|
|
232
272
|
const diffPropsString = generatePropsDiffString(
|
|
233
273
|
newName,
|
|
234
274
|
componentName,
|
|
235
275
|
component,
|
|
276
|
+
debugProps,
|
|
277
|
+
includeGetDebugPropsImplementation,
|
|
236
278
|
);
|
|
237
279
|
|
|
238
280
|
const imports = getImports(component.props);
|
|
@@ -43,8 +43,18 @@ ${componentClasses}
|
|
|
43
43
|
|
|
44
44
|
} // namespace facebook::react
|
|
45
45
|
`;
|
|
46
|
-
const ClassTemplate = ({
|
|
47
|
-
|
|
46
|
+
const ClassTemplate = ({
|
|
47
|
+
enums,
|
|
48
|
+
structs,
|
|
49
|
+
className,
|
|
50
|
+
props,
|
|
51
|
+
extendClasses,
|
|
52
|
+
includeGetDebugPropsImplementation,
|
|
53
|
+
}) => {
|
|
54
|
+
const getDebugPropsString = `#if RN_DEBUG_STRING_CONVERTIBLE
|
|
55
|
+
SharedDebugStringConvertibleList getDebugProps() const override;
|
|
56
|
+
#endif`;
|
|
57
|
+
return `
|
|
48
58
|
${enums}
|
|
49
59
|
${structs}
|
|
50
60
|
class ${className} final${extendClasses} {
|
|
@@ -61,8 +71,11 @@ class ${className} final${extendClasses} {
|
|
|
61
71
|
|
|
62
72
|
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
|
63
73
|
#endif
|
|
74
|
+
|
|
75
|
+
${includeGetDebugPropsImplementation ? getDebugPropsString : ''}
|
|
64
76
|
};
|
|
65
77
|
`.trim();
|
|
78
|
+
};
|
|
66
79
|
const EnumTemplate = ({enumName, values, fromCases, toCases}) =>
|
|
67
80
|
`
|
|
68
81
|
enum class ${enumName} { ${values} };
|
|
@@ -121,6 +134,7 @@ const StructTemplate = ({structName, fields, fromCases, toDynamicCases}) =>
|
|
|
121
134
|
`struct ${structName} {
|
|
122
135
|
${fields}
|
|
123
136
|
|
|
137
|
+
|
|
124
138
|
#ifdef RN_SERIALIZABLE_STATE
|
|
125
139
|
bool operator==(const ${structName}&) const = default;
|
|
126
140
|
|
|
@@ -400,6 +414,7 @@ function generatePropsString(componentName, props, nameParts) {
|
|
|
400
414
|
function getExtendsImports(extendsProps) {
|
|
401
415
|
const imports = new Set();
|
|
402
416
|
imports.add('#include <react/renderer/core/PropsParserContext.h>');
|
|
417
|
+
imports.add('#include <react/renderer/debug/DebugStringConvertible.h>');
|
|
403
418
|
extendsProps.forEach(extendProps => {
|
|
404
419
|
switch (extendProps.type) {
|
|
405
420
|
case 'ReactNativeBuiltInType':
|
|
@@ -618,6 +633,7 @@ module.exports = {
|
|
|
618
633
|
packageName,
|
|
619
634
|
assumeNonnull = false,
|
|
620
635
|
headerPrefix,
|
|
636
|
+
includeGetDebugPropsImplementation = false,
|
|
621
637
|
) {
|
|
622
638
|
const fileName = 'Props.h';
|
|
623
639
|
const allImports = new Set();
|
|
@@ -660,6 +676,7 @@ module.exports = {
|
|
|
660
676
|
className: newName,
|
|
661
677
|
extendClasses: extendString,
|
|
662
678
|
props: propsString,
|
|
679
|
+
includeGetDebugPropsImplementation,
|
|
663
680
|
});
|
|
664
681
|
return replacedTemplate;
|
|
665
682
|
})
|
|
@@ -65,14 +65,20 @@ const ClassTemplate = ({
|
|
|
65
65
|
className,
|
|
66
66
|
props,
|
|
67
67
|
extendClasses,
|
|
68
|
+
includeGetDebugPropsImplementation,
|
|
68
69
|
}: {
|
|
69
70
|
enums: string,
|
|
70
71
|
structs: string,
|
|
71
72
|
className: string,
|
|
72
73
|
props: string,
|
|
73
74
|
extendClasses: string,
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
includeGetDebugPropsImplementation: boolean,
|
|
76
|
+
}) => {
|
|
77
|
+
const getDebugPropsString = `#if RN_DEBUG_STRING_CONVERTIBLE
|
|
78
|
+
SharedDebugStringConvertibleList getDebugProps() const override;
|
|
79
|
+
#endif`;
|
|
80
|
+
|
|
81
|
+
return `
|
|
76
82
|
${enums}
|
|
77
83
|
${structs}
|
|
78
84
|
class ${className} final${extendClasses} {
|
|
@@ -89,8 +95,11 @@ class ${className} final${extendClasses} {
|
|
|
89
95
|
|
|
90
96
|
folly::dynamic getDiffProps(const Props* prevProps) const override;
|
|
91
97
|
#endif
|
|
98
|
+
|
|
99
|
+
${includeGetDebugPropsImplementation ? getDebugPropsString : ''}
|
|
92
100
|
};
|
|
93
101
|
`.trim();
|
|
102
|
+
};
|
|
94
103
|
|
|
95
104
|
const EnumTemplate = ({
|
|
96
105
|
enumName,
|
|
@@ -178,6 +187,7 @@ const StructTemplate = ({
|
|
|
178
187
|
`struct ${structName} {
|
|
179
188
|
${fields}
|
|
180
189
|
|
|
190
|
+
|
|
181
191
|
#ifdef RN_SERIALIZABLE_STATE
|
|
182
192
|
bool operator==(const ${structName}&) const = default;
|
|
183
193
|
|
|
@@ -536,6 +546,7 @@ function getExtendsImports(
|
|
|
536
546
|
const imports: Set<string> = new Set();
|
|
537
547
|
|
|
538
548
|
imports.add('#include <react/renderer/core/PropsParserContext.h>');
|
|
549
|
+
imports.add('#include <react/renderer/debug/DebugStringConvertible.h>');
|
|
539
550
|
|
|
540
551
|
extendsProps.forEach(extendProps => {
|
|
541
552
|
switch (extendProps.type) {
|
|
@@ -783,6 +794,7 @@ module.exports = {
|
|
|
783
794
|
packageName?: string,
|
|
784
795
|
assumeNonnull: boolean = false,
|
|
785
796
|
headerPrefix?: string,
|
|
797
|
+
includeGetDebugPropsImplementation?: boolean = false,
|
|
786
798
|
): FilesOutput {
|
|
787
799
|
const fileName = 'Props.h';
|
|
788
800
|
|
|
@@ -831,6 +843,7 @@ module.exports = {
|
|
|
831
843
|
className: newName,
|
|
832
844
|
extendClasses: extendString,
|
|
833
845
|
props: propsString,
|
|
846
|
+
includeGetDebugPropsImplementation,
|
|
834
847
|
});
|
|
835
848
|
|
|
836
849
|
return replacedTemplate;
|
|
@@ -246,6 +246,7 @@ module.exports = {
|
|
|
246
246
|
packageName,
|
|
247
247
|
assumeNonnull = false,
|
|
248
248
|
headerPrefix,
|
|
249
|
+
includeGetDebugPropsImplementation = false,
|
|
249
250
|
) {
|
|
250
251
|
// TODO: This doesn't support custom package name yet.
|
|
251
252
|
const normalizedPackageName = 'com.facebook.react.viewmanagers';
|
|
@@ -299,6 +299,7 @@ module.exports = {
|
|
|
299
299
|
packageName?: string,
|
|
300
300
|
assumeNonnull: boolean = false,
|
|
301
301
|
headerPrefix?: string,
|
|
302
|
+
includeGetDebugPropsImplementation?: boolean = false,
|
|
302
303
|
): FilesOutput {
|
|
303
304
|
// TODO: This doesn't support custom package name yet.
|
|
304
305
|
const normalizedPackageName = 'com.facebook.react.viewmanagers';
|
|
@@ -195,6 +195,7 @@ module.exports = {
|
|
|
195
195
|
packageName,
|
|
196
196
|
assumeNonnull = false,
|
|
197
197
|
headerPrefix,
|
|
198
|
+
includeGetDebugPropsImplementation = false,
|
|
198
199
|
) {
|
|
199
200
|
// TODO: This doesn't support custom package name yet.
|
|
200
201
|
const normalizedPackageName = 'com.facebook.react.viewmanagers';
|
|
@@ -238,6 +238,7 @@ module.exports = {
|
|
|
238
238
|
packageName?: string,
|
|
239
239
|
assumeNonnull: boolean = false,
|
|
240
240
|
headerPrefix?: string,
|
|
241
|
+
includeGetDebugPropsImplementation?: boolean = false,
|
|
241
242
|
): FilesOutput {
|
|
242
243
|
// TODO: This doesn't support custom package name yet.
|
|
243
244
|
const normalizedPackageName = 'com.facebook.react.viewmanagers';
|