Skip to content

Commit b9baddf

Browse files
generatedunixname89002005287564meta-codesync[bot]
authored andcommitted
Fix CQS signal modernize-use-designated-initializers in xplat/js/react-native-github/packages [B] (facebook#54003)
Summary: Pull Request resolved: facebook#54003 Reviewed By: javache Differential Revision: D83622358 fbshipit-source-id: e0b4bdd65d8af9ec0e25c28a2e02371d52154c2d
1 parent 068ec39 commit b9baddf

File tree

7 files changed

+30
-18
lines changed

7 files changed

+30
-18
lines changed

packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/cxx/react/renderer/textlayoutmanager/TextLayoutManager.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,17 @@ TextMeasurement TextLayoutManager::measure(
2121
TextMeasurement::Attachments attachments;
2222
for (const auto& fragment : attributedStringBox.getValue().getFragments()) {
2323
if (fragment.isAttachment()) {
24-
attachments.push_back(
25-
TextMeasurement::Attachment{{{0, 0}, {0, 0}}, false});
24+
attachments.push_back(TextMeasurement::Attachment{
25+
.frame =
26+
{.origin = {.x = 0, .y = 0}, .size = {.width = 0, .height = 0}},
27+
.isClipped = false});
2628
}
2729
}
2830
return TextMeasurement{
29-
{layoutConstraints.minimumSize.width,
30-
layoutConstraints.minimumSize.height},
31-
attachments};
31+
.size =
32+
{.width = layoutConstraints.minimumSize.width,
33+
.height = layoutConstraints.minimumSize.height},
34+
.attachments = attachments};
3235
}
3336

3437
} // namespace facebook::react

packages/react-native/ReactCommon/react/renderer/uimanager/PointerEventsProcessor.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,12 @@ static PointerEventTarget retargetPointerEvent(
104104
// More work will be needed to properly take non-trival transforms into
105105
// account.
106106
auto layoutMetrics = uiManager.getRelativeLayoutMetrics(
107-
*latestNodeToTarget, nullptr, {/* .includeTransform */ true});
107+
*latestNodeToTarget,
108+
nullptr,
109+
{/* .includeTransform */ .includeTransform = true});
108110
retargetedEvent.offsetPoint = {
109-
event.clientPoint.x - layoutMetrics.frame.origin.x,
110-
event.clientPoint.y - layoutMetrics.frame.origin.y,
111+
.x = event.clientPoint.x - layoutMetrics.frame.origin.x,
112+
.y = event.clientPoint.y - layoutMetrics.frame.origin.y,
111113
};
112114

113115
PointerEventTarget result = {};

packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ std::shared_ptr<ShadowNode> UIManager::createNode(
7373
PropsParserContext propsParserContext{surfaceId, *contextContainer_.get()};
7474

7575
auto family = componentDescriptor.createFamily(
76-
{tag, surfaceId, std::move(instanceHandle)});
76+
{.tag = tag,
77+
.surfaceId = surfaceId,
78+
.instanceHandle = std::move(instanceHandle)});
7779
const auto props = componentDescriptor.cloneProps(
7880
propsParserContext, nullptr, std::move(rawProps));
7981
const auto state = componentDescriptor.createInitialState(props, family);
@@ -462,7 +464,7 @@ void UIManager::setNativeProps_DEPRECATED(
462464
->getProps(),
463465
RawProps(rawProps));
464466

465-
return oldShadowNode.clone({/* .props = */ props});
467+
return oldShadowNode.clone({/* .props = */ .props = props});
466468
});
467469

468470
return std::static_pointer_cast<RootShadowNode>(rootNode);

packages/react-native/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,8 @@ jsi::Value UIManagerBinding::get(
277277
auto locationY = (Float)arguments[2].getNumber();
278278
auto onSuccessFunction =
279279
arguments[3].getObject(runtime).getFunction(runtime);
280-
auto targetNode =
281-
uiManager->findNodeAtPoint(node, Point{locationX, locationY});
280+
auto targetNode = uiManager->findNodeAtPoint(
281+
node, Point{.x = locationX, .y = locationY});
282282

283283
if (!targetNode) {
284284
onSuccessFunction.call(runtime, jsi::Value::null());
@@ -511,7 +511,7 @@ jsi::Value UIManagerBinding::get(
511511
Bridging<std::shared_ptr<const ShadowNode>>::fromJs(
512512
runtime, arguments[1])
513513
.get(),
514-
{/* .includeTransform = */ false});
514+
{/* .includeTransform = */ .includeTransform = false});
515515
auto frame = layoutMetrics.frame;
516516
auto result = jsi::Object(runtime);
517517
result.setProperty(runtime, "left", frame.origin.x);

packages/react-native/ReactCommon/react/renderer/uimanager/tests/PointerEventsProcessorTest.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ class PointerEventsProcessorTest : public ::testing::Test {
4343
auto componentDescriptorRegistry =
4444
componentDescriptorProviderRegistry.createComponentDescriptorRegistry(
4545
ComponentDescriptorParameters{
46-
eventDispatcher, std::move(contextContainer), nullptr});
46+
.eventDispatcher = eventDispatcher,
47+
.contextContainer = std::move(contextContainer),
48+
.flavor = nullptr});
4749

4850
componentDescriptorProviderRegistry.add(
4951
concreteComponentDescriptorProvider<RootComponentDescriptor>());
@@ -83,7 +85,7 @@ class PointerEventsProcessorTest : public ::testing::Test {
8385
auto sharedProps = std::make_shared<RootProps>();
8486
auto &props = *sharedProps;
8587
listenToAllPointerEvents(props);
86-
props.layoutConstraints = LayoutConstraints{{0,0}, {500, 500}};
88+
props.layoutConstraints = LayoutConstraints{.minimumSize={.width=0,.height=0}, .maximumSize={.width=500, .height=500}};
8789
auto &yogaStyle = props.yogaStyle;
8890
yogaStyle.setDimension(yoga::Dimension::Width, yoga::StyleSizeLength::points(400));
8991
yogaStyle.setDimension(yoga::Dimension::Height, yoga::StyleSizeLength::points(400));

packages/react-native/ReactCommon/react/utils/tests/hash_combineTests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ TEST(hash_combineTests, testStrings) {
6767
}
6868

6969
TEST(hash_combineTests, testCustomTypes) {
70-
auto person1 = Person{"John", "Doe"};
71-
auto person2 = Person{"Jane", "Doe"};
70+
auto person1 = Person{.firstName = "John", .lastName = "Doe"};
71+
auto person2 = Person{.firstName = "Jane", .lastName = "Doe"};
7272

7373
std::size_t seed = 0;
7474
hash_combine(seed, person1);

packages/react-native/ReactCommon/reactperflogger/fusebox/FuseboxTracer.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ void FuseboxTracer::addEvent(
110110
return;
111111
}
112112
buffer_.push_back(BufferEvent{
113-
start, end, std::string(name), std::string(track.value_or(""))});
113+
.start = start,
114+
.end = end,
115+
.name = std::string(name),
116+
.track = std::string(track.value_or(""))});
114117
}
115118

116119
bool FuseboxTracer::stopTracingAndWriteToFile(const std::string& path) {

0 commit comments

Comments
 (0)