Skip to content

Commit c4dd2b2

Browse files
committed
fix: adapt conic gradient colors to upstream conversion
1 parent 74c2a5f commit c4dd2b2

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

‎packages/react-native/ReactCommon/react/renderer/components/view/BackgroundImagePropsConversions.cpp‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,7 @@ void parseUnprocessedBackgroundImageList(
313313
if (type == "conic-gradient") {
314314
const bool isHint =
315315
colorIt == stopMap.end() || !colorIt->second.hasValue();
316-
const auto positionCount =
317-
positionsIt != stopMap.end() &&
316+
const auto positionCount = positionsIt != stopMap.end() &&
318317
positionsIt->second.hasType<RawValueList>()
319318
? static_cast<RawValueList>(positionsIt->second).size()
320319
: 0;
@@ -362,8 +361,8 @@ void parseUnprocessedBackgroundImageList(
362361
auto color = coerceColor(colorIt->second, context);
363362
if (color) {
364363
colorStop.color = color;
365-
} else if (type == "conic-gradient" &&
366-
colorIt->second.hasValue()) {
364+
} else if (
365+
type == "conic-gradient" && colorIt->second.hasValue()) {
367366
result = {};
368367
return;
369368
}
@@ -621,7 +620,11 @@ void fromCSSConicColorStop(
621620

622621
const auto& colorStop = std::get<CSSConicColorStop>(item);
623622
ColorStop start;
624-
start.color = fromCSSColor(colorStop.color);
623+
start.color = colorFromRGBA(
624+
colorStop.color.r,
625+
colorStop.color.g,
626+
colorStop.color.b,
627+
colorStop.color.a);
625628
if (colorStop.startPosition.has_value()) {
626629
start.position =
627630
convertAngularPositionToValueUnit(*colorStop.startPosition);
@@ -630,7 +633,7 @@ void fromCSSConicColorStop(
630633

631634
if (colorStop.endPosition.has_value()) {
632635
ColorStop end;
633-
end.color = fromCSSColor(colorStop.color);
636+
end.color = start.color;
634637
end.position = convertAngularPositionToValueUnit(*colorStop.endPosition);
635638
colorStops.push_back(end);
636639
}

0 commit comments

Comments
 (0)