Fix CQS signal modernize-use-designated-initializers in xplat/js/react-native-github/packages [A]

Reviewed By: rshest

Differential Revision: D80547462
This commit is contained in:
CodemodService Bot
2025-08-20 00:50:47 -07:00
committed by Facebook GitHub Bot
parent d1a1020a4a
commit bb80b38d39
4 changed files with 14 additions and 13 deletions
@@ -34,10 +34,10 @@ inline Color hostPlatformColorFromComponents(ColorComponents components) {
inline ColorComponents colorComponentsFromHostPlatformColor(Color color) {
float ratio = 255;
return ColorComponents{
(float)((color >> 16) & 0xff) / ratio,
(float)((color >> 8) & 0xff) / ratio,
(float)((color >> 0) & 0xff) / ratio,
(float)((color >> 24) & 0xff) / ratio};
.red = (float)((color >> 16) & 0xff) / ratio,
.green = (float)((color >> 8) & 0xff) / ratio,
.blue = (float)((color >> 0) & 0xff) / ratio,
.alpha = (float)((color >> 24) & 0xff) / ratio};
}
inline float alphaFromHostPlatformColor(Color color) {
@@ -40,10 +40,10 @@ struct Color {
float ratio = 255;
int32_t primitiveColor = getColor();
return ColorComponents{
(float)((primitiveColor >> 16) & 0xff) / ratio,
(float)((primitiveColor >> 8) & 0xff) / ratio,
(float)((primitiveColor >> 0) & 0xff) / ratio,
(float)((primitiveColor >> 24) & 0xff) / ratio};
.red = (float)((primitiveColor >> 16) & 0xff) / ratio,
.green = (float)((primitiveColor >> 8) & 0xff) / ratio,
.blue = (float)((primitiveColor >> 0) & 0xff) / ratio,
.alpha = (float)((primitiveColor >> 24) & 0xff) / ratio};
}
bool operator==(const Color& other) const;
bool operator!=(const Color& other) const;
@@ -96,7 +96,8 @@ int32_t ColorFromUIColor(UIColor *color)
{
CGFloat rgba[4];
[color getRed:&rgba[0] green:&rgba[1] blue:&rgba[2] alpha:&rgba[3]];
return ColorFromColorComponents({(float)rgba[0], (float)rgba[1], (float)rgba[2], (float)rgba[3]});
return ColorFromColorComponents(
{.red = (float)rgba[0], .green = (float)rgba[1], .blue = (float)rgba[2], .alpha = (float)rgba[3]});
}
int32_t ColorFromUIColorForSpecificTraitCollection(
@@ -43,10 +43,10 @@ inline facebook::react::SharedColor RCTPlatformColorComponentsFromDynamicItems(
}
Color color = Color(DynamicColor{
(*lightSharedColor).getColor(),
(*darkSharedColor).getColor(),
(*highContrastLightSharedColor).getColor(),
(*highContrastDarkSharedColor).getColor()});
.lightColor = (*lightSharedColor).getColor(),
.darkColor = (*darkSharedColor).getColor(),
.highContrastLightColor = (*highContrastLightSharedColor).getColor(),
.highContrastDarkColor = (*highContrastDarkSharedColor).getColor()});
return SharedColor(color);
}