Compare commits

...
1 Commits
Author SHA1 Message Date
CodemodService Bot 6b1359fcf6 Fix CQS signal modernize-use-designated-initializers in xplat/js/react-native-github/packages [B] (#54003)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/54003

Reviewed By: javache

Differential Revision: D83622358
2025-10-04 18:34:33 -07:00
7 changed files with 30 additions and 18 deletions
@@ -21,14 +21,17 @@ TextMeasurement TextLayoutManager::measure(
TextMeasurement::Attachments attachments;
for (const auto& fragment : attributedStringBox.getValue().getFragments()) {
if (fragment.isAttachment()) {
attachments.push_back(
TextMeasurement::Attachment{{{0, 0}, {0, 0}}, false});
attachments.push_back(TextMeasurement::Attachment{
.frame =
{.origin = {.x = 0, .y = 0}, .size = {.width = 0, .height = 0}},
.isClipped = false});
}
}
return TextMeasurement{
{layoutConstraints.minimumSize.width,
layoutConstraints.minimumSize.height},
attachments};
.size =
{.width = layoutConstraints.minimumSize.width,
.height = layoutConstraints.minimumSize.height},
.attachments = attachments};
}
} // namespace facebook::react
@@ -104,10 +104,12 @@ static PointerEventTarget retargetPointerEvent(
// More work will be needed to properly take non-trival transforms into
// account.
auto layoutMetrics = uiManager.getRelativeLayoutMetrics(
*latestNodeToTarget, nullptr, {/* .includeTransform */ true});
*latestNodeToTarget,
nullptr,
{/* .includeTransform */ .includeTransform = true});
retargetedEvent.offsetPoint = {
event.clientPoint.x - layoutMetrics.frame.origin.x,
event.clientPoint.y - layoutMetrics.frame.origin.y,
.x = event.clientPoint.x - layoutMetrics.frame.origin.x,
.y = event.clientPoint.y - layoutMetrics.frame.origin.y,
};
PointerEventTarget result = {};
@@ -73,7 +73,9 @@ std::shared_ptr<ShadowNode> UIManager::createNode(
PropsParserContext propsParserContext{surfaceId, *contextContainer_.get()};
auto family = componentDescriptor.createFamily(
{tag, surfaceId, std::move(instanceHandle)});
{.tag = tag,
.surfaceId = surfaceId,
.instanceHandle = std::move(instanceHandle)});
const auto props = componentDescriptor.cloneProps(
propsParserContext, nullptr, std::move(rawProps));
const auto state = componentDescriptor.createInitialState(props, family);
@@ -462,7 +464,7 @@ void UIManager::setNativeProps_DEPRECATED(
->getProps(),
RawProps(rawProps));
return oldShadowNode.clone({/* .props = */ props});
return oldShadowNode.clone({/* .props = */ .props = props});
});
return std::static_pointer_cast<RootShadowNode>(rootNode);
@@ -277,8 +277,8 @@ jsi::Value UIManagerBinding::get(
auto locationY = (Float)arguments[2].getNumber();
auto onSuccessFunction =
arguments[3].getObject(runtime).getFunction(runtime);
auto targetNode =
uiManager->findNodeAtPoint(node, Point{locationX, locationY});
auto targetNode = uiManager->findNodeAtPoint(
node, Point{.x = locationX, .y = locationY});
if (!targetNode) {
onSuccessFunction.call(runtime, jsi::Value::null());
@@ -511,7 +511,7 @@ jsi::Value UIManagerBinding::get(
Bridging<std::shared_ptr<const ShadowNode>>::fromJs(
runtime, arguments[1])
.get(),
{/* .includeTransform = */ false});
{/* .includeTransform = */ .includeTransform = false});
auto frame = layoutMetrics.frame;
auto result = jsi::Object(runtime);
result.setProperty(runtime, "left", frame.origin.x);
@@ -43,7 +43,9 @@ class PointerEventsProcessorTest : public ::testing::Test {
auto componentDescriptorRegistry =
componentDescriptorProviderRegistry.createComponentDescriptorRegistry(
ComponentDescriptorParameters{
eventDispatcher, std::move(contextContainer), nullptr});
.eventDispatcher = eventDispatcher,
.contextContainer = std::move(contextContainer),
.flavor = nullptr});
componentDescriptorProviderRegistry.add(
concreteComponentDescriptorProvider<RootComponentDescriptor>());
@@ -83,7 +85,7 @@ class PointerEventsProcessorTest : public ::testing::Test {
auto sharedProps = std::make_shared<RootProps>();
auto &props = *sharedProps;
listenToAllPointerEvents(props);
props.layoutConstraints = LayoutConstraints{{0,0}, {500, 500}};
props.layoutConstraints = LayoutConstraints{.minimumSize={.width=0,.height=0}, .maximumSize={.width=500, .height=500}};
auto &yogaStyle = props.yogaStyle;
yogaStyle.setDimension(yoga::Dimension::Width, yoga::StyleSizeLength::points(400));
yogaStyle.setDimension(yoga::Dimension::Height, yoga::StyleSizeLength::points(400));
@@ -67,8 +67,8 @@ TEST(hash_combineTests, testStrings) {
}
TEST(hash_combineTests, testCustomTypes) {
auto person1 = Person{"John", "Doe"};
auto person2 = Person{"Jane", "Doe"};
auto person1 = Person{.firstName = "John", .lastName = "Doe"};
auto person2 = Person{.firstName = "Jane", .lastName = "Doe"};
std::size_t seed = 0;
hash_combine(seed, person1);
@@ -110,7 +110,10 @@ void FuseboxTracer::addEvent(
return;
}
buffer_.push_back(BufferEvent{
start, end, std::string(name), std::string(track.value_or(""))});
.start = start,
.end = end,
.name = std::string(name),
.track = std::string(track.value_or(""))});
}
bool FuseboxTracer::stopTracingAndWriteToFile(const std::string& path) {