Skip to content

Commit ea6078f

Browse files
Nick Lefeverfacebook-github-bot
authored andcommitted
Add fixtures for optional props generation (facebook#54725)
Summary: See title Changelog: [Internal] Differential Revision: D87843980
1 parent 5065258 commit ea6078f

19 files changed

+6934
-494
lines changed

packages/react-native-codegen/src/generators/components/__test_fixtures__/fixtures.js

Lines changed: 972 additions & 0 deletions
Large diffs are not rendered by default.

packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateComponentDescriptorCpp-test.js.snap

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,61 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3+
exports[`GenerateComponentDescriptorCpp can generate fixture ALL_PROP 1`] = `
4+
Map {
5+
"ComponentDescriptors.cpp" => "
6+
/**
7+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
8+
*
9+
* Do not edit this file as changes may cause incorrect behavior and will be lost
10+
* once the code is regenerated.
11+
*
12+
* @generated by codegen project: GenerateComponentDescriptorCpp.js
13+
*/
14+
15+
#include <react/renderer/components/ALL_PROP/ComponentDescriptors.h>
16+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
17+
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
18+
19+
namespace facebook::react {
20+
21+
void ALL_PROP_registerComponentDescriptorsFromCodegen(
22+
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
23+
registry->add(concreteComponentDescriptorProvider<AllPropComponentDescriptor>());
24+
}
25+
26+
} // namespace facebook::react
27+
",
28+
}
29+
`;
30+
31+
exports[`GenerateComponentDescriptorCpp can generate fixture ALL_PROP_WITH_OPTIONAL_GEN 1`] = `
32+
Map {
33+
"ComponentDescriptors.cpp" => "
34+
/**
35+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
36+
*
37+
* Do not edit this file as changes may cause incorrect behavior and will be lost
38+
* once the code is regenerated.
39+
*
40+
* @generated by codegen project: GenerateComponentDescriptorCpp.js
41+
*/
42+
43+
#include <react/renderer/components/ALL_PROP_WITH_OPTIONAL_GEN/ComponentDescriptors.h>
44+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
45+
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
46+
47+
namespace facebook::react {
48+
49+
void ALL_PROP_WITH_OPTIONAL_GEN_registerComponentDescriptorsFromCodegen(
50+
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
51+
registry->add(concreteComponentDescriptorProvider<AllPropWithOptionalGenComponentDescriptor>());
52+
}
53+
54+
} // namespace facebook::react
55+
",
56+
}
57+
`;
58+
359
exports[`GenerateComponentDescriptorCpp can generate fixture ARRAY_PROPS 1`] = `
460
Map {
561
"ComponentDescriptors.cpp" => "
@@ -56,6 +112,62 @@ registry->add(concreteComponentDescriptorProvider<ArrayPropsNativeComponentCompo
56112
}
57113
`;
58114
115+
exports[`GenerateComponentDescriptorCpp can generate fixture ARRAY_PROPS_WITH_NESTED_OBJECT_WITH_OPTIONAL_GEN 1`] = `
116+
Map {
117+
"ComponentDescriptors.cpp" => "
118+
/**
119+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
120+
*
121+
* Do not edit this file as changes may cause incorrect behavior and will be lost
122+
* once the code is regenerated.
123+
*
124+
* @generated by codegen project: GenerateComponentDescriptorCpp.js
125+
*/
126+
127+
#include <react/renderer/components/ARRAY_PROPS_WITH_NESTED_OBJECT_WITH_OPTIONAL_GEN/ComponentDescriptors.h>
128+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
129+
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
130+
131+
namespace facebook::react {
132+
133+
void ARRAY_PROPS_WITH_NESTED_OBJECT_WITH_OPTIONAL_GEN_registerComponentDescriptorsFromCodegen(
134+
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
135+
registry->add(concreteComponentDescriptorProvider<ArrayPropsNativeComponentComponentDescriptor>());
136+
}
137+
138+
} // namespace facebook::react
139+
",
140+
}
141+
`;
142+
143+
exports[`GenerateComponentDescriptorCpp can generate fixture ARRAY_PROPS_WITH_OPTIONAL_GEN 1`] = `
144+
Map {
145+
"ComponentDescriptors.cpp" => "
146+
/**
147+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
148+
*
149+
* Do not edit this file as changes may cause incorrect behavior and will be lost
150+
* once the code is regenerated.
151+
*
152+
* @generated by codegen project: GenerateComponentDescriptorCpp.js
153+
*/
154+
155+
#include <react/renderer/components/ARRAY_PROPS_WITH_OPTIONAL_GEN/ComponentDescriptors.h>
156+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
157+
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
158+
159+
namespace facebook::react {
160+
161+
void ARRAY_PROPS_WITH_OPTIONAL_GEN_registerComponentDescriptorsFromCodegen(
162+
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
163+
registry->add(concreteComponentDescriptorProvider<ArrayPropsNativeComponentComponentDescriptor>());
164+
}
165+
166+
} // namespace facebook::react
167+
",
168+
}
169+
`;
170+
59171
exports[`GenerateComponentDescriptorCpp can generate fixture BOOLEAN_PROP 1`] = `
60172
Map {
61173
"ComponentDescriptors.cpp" => "
@@ -673,6 +785,34 @@ registry->add(concreteComponentDescriptorProvider<ObjectPropsComponentDescriptor
673785
}
674786
`;
675787
788+
exports[`GenerateComponentDescriptorCpp can generate fixture OBJECT_PROPS_WITH_OPTIONAL_GEN 1`] = `
789+
Map {
790+
"ComponentDescriptors.cpp" => "
791+
/**
792+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
793+
*
794+
* Do not edit this file as changes may cause incorrect behavior and will be lost
795+
* once the code is regenerated.
796+
*
797+
* @generated by codegen project: GenerateComponentDescriptorCpp.js
798+
*/
799+
800+
#include <react/renderer/components/OBJECT_PROPS_WITH_OPTIONAL_GEN/ComponentDescriptors.h>
801+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
802+
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
803+
804+
namespace facebook::react {
805+
806+
void OBJECT_PROPS_WITH_OPTIONAL_GEN_registerComponentDescriptorsFromCodegen(
807+
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
808+
registry->add(concreteComponentDescriptorProvider<ObjectPropsComponentDescriptor>());
809+
}
810+
811+
} // namespace facebook::react
812+
",
813+
}
814+
`;
815+
676816
exports[`GenerateComponentDescriptorCpp can generate fixture POINT_PROP 1`] = `
677817
Map {
678818
"ComponentDescriptors.cpp" => "

packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateComponentDescriptorH-test.js.snap

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,65 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3+
exports[`GenerateComponentDescriptorH can generate fixture ALL_PROP 1`] = `
4+
Map {
5+
"ComponentDescriptors.h" => "
6+
/**
7+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
8+
*
9+
* Do not edit this file as changes may cause incorrect behavior and will be lost
10+
* once the code is regenerated.
11+
*
12+
* @generated by codegen project: GenerateComponentDescriptorH.js
13+
*/
14+
15+
#pragma once
16+
17+
#include <react/renderer/components/ALL_PROP/ShadowNodes.h>
18+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
19+
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
20+
21+
namespace facebook::react {
22+
23+
using AllPropComponentDescriptor = ConcreteComponentDescriptor<AllPropShadowNode>;
24+
25+
void ALL_PROP_registerComponentDescriptorsFromCodegen(
26+
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
27+
28+
} // namespace facebook::react
29+
",
30+
}
31+
`;
32+
33+
exports[`GenerateComponentDescriptorH can generate fixture ALL_PROP_WITH_OPTIONAL_GEN 1`] = `
34+
Map {
35+
"ComponentDescriptors.h" => "
36+
/**
37+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
38+
*
39+
* Do not edit this file as changes may cause incorrect behavior and will be lost
40+
* once the code is regenerated.
41+
*
42+
* @generated by codegen project: GenerateComponentDescriptorH.js
43+
*/
44+
45+
#pragma once
46+
47+
#include <react/renderer/components/ALL_PROP_WITH_OPTIONAL_GEN/ShadowNodes.h>
48+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
49+
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
50+
51+
namespace facebook::react {
52+
53+
using AllPropWithOptionalGenComponentDescriptor = ConcreteComponentDescriptor<AllPropWithOptionalGenShadowNode>;
54+
55+
void ALL_PROP_WITH_OPTIONAL_GEN_registerComponentDescriptorsFromCodegen(
56+
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
57+
58+
} // namespace facebook::react
59+
",
60+
}
61+
`;
62+
363
exports[`GenerateComponentDescriptorH can generate fixture ARRAY_PROPS 1`] = `
464
Map {
565
"ComponentDescriptors.h" => "
@@ -60,6 +120,66 @@ void ARRAY_PROPS_WITH_NESTED_OBJECT_registerComponentDescriptorsFromCodegen(
60120
}
61121
`;
62122
123+
exports[`GenerateComponentDescriptorH can generate fixture ARRAY_PROPS_WITH_NESTED_OBJECT_WITH_OPTIONAL_GEN 1`] = `
124+
Map {
125+
"ComponentDescriptors.h" => "
126+
/**
127+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
128+
*
129+
* Do not edit this file as changes may cause incorrect behavior and will be lost
130+
* once the code is regenerated.
131+
*
132+
* @generated by codegen project: GenerateComponentDescriptorH.js
133+
*/
134+
135+
#pragma once
136+
137+
#include <react/renderer/components/ARRAY_PROPS_WITH_NESTED_OBJECT_WITH_OPTIONAL_GEN/ShadowNodes.h>
138+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
139+
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
140+
141+
namespace facebook::react {
142+
143+
using ArrayPropsNativeComponentComponentDescriptor = ConcreteComponentDescriptor<ArrayPropsNativeComponentShadowNode>;
144+
145+
void ARRAY_PROPS_WITH_NESTED_OBJECT_WITH_OPTIONAL_GEN_registerComponentDescriptorsFromCodegen(
146+
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
147+
148+
} // namespace facebook::react
149+
",
150+
}
151+
`;
152+
153+
exports[`GenerateComponentDescriptorH can generate fixture ARRAY_PROPS_WITH_OPTIONAL_GEN 1`] = `
154+
Map {
155+
"ComponentDescriptors.h" => "
156+
/**
157+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
158+
*
159+
* Do not edit this file as changes may cause incorrect behavior and will be lost
160+
* once the code is regenerated.
161+
*
162+
* @generated by codegen project: GenerateComponentDescriptorH.js
163+
*/
164+
165+
#pragma once
166+
167+
#include <react/renderer/components/ARRAY_PROPS_WITH_OPTIONAL_GEN/ShadowNodes.h>
168+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
169+
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
170+
171+
namespace facebook::react {
172+
173+
using ArrayPropsNativeComponentComponentDescriptor = ConcreteComponentDescriptor<ArrayPropsNativeComponentShadowNode>;
174+
175+
void ARRAY_PROPS_WITH_OPTIONAL_GEN_registerComponentDescriptorsFromCodegen(
176+
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
177+
178+
} // namespace facebook::react
179+
",
180+
}
181+
`;
182+
63183
exports[`GenerateComponentDescriptorH can generate fixture BOOLEAN_PROP 1`] = `
64184
Map {
65185
"ComponentDescriptors.h" => "
@@ -721,6 +841,36 @@ void OBJECT_PROPS_registerComponentDescriptorsFromCodegen(
721841
}
722842
`;
723843
844+
exports[`GenerateComponentDescriptorH can generate fixture OBJECT_PROPS_WITH_OPTIONAL_GEN 1`] = `
845+
Map {
846+
"ComponentDescriptors.h" => "
847+
/**
848+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
849+
*
850+
* Do not edit this file as changes may cause incorrect behavior and will be lost
851+
* once the code is regenerated.
852+
*
853+
* @generated by codegen project: GenerateComponentDescriptorH.js
854+
*/
855+
856+
#pragma once
857+
858+
#include <react/renderer/components/OBJECT_PROPS_WITH_OPTIONAL_GEN/ShadowNodes.h>
859+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
860+
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
861+
862+
namespace facebook::react {
863+
864+
using ObjectPropsComponentDescriptor = ConcreteComponentDescriptor<ObjectPropsShadowNode>;
865+
866+
void OBJECT_PROPS_WITH_OPTIONAL_GEN_registerComponentDescriptorsFromCodegen(
867+
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
868+
869+
} // namespace facebook::react
870+
",
871+
}
872+
`;
873+
724874
exports[`GenerateComponentDescriptorH can generate fixture POINT_PROP 1`] = `
725875
Map {
726876
"ComponentDescriptors.h" => "

0 commit comments

Comments
 (0)