Skip to content

Commit 8073e98

Browse files
[repro] View Props 2.0 payload: a gradient color hint is sent as a transparent stop
1 parent 22dc125 commit 8073e98

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,22 @@ TEST(ViewPropsDiffTest, removingShadowColorEmitsNull) {
8787
});
8888
}
8989

90+
// The Android gradients treat a stop with a null color as a transition hint;
91+
// 0 is a transparent stop.
92+
TEST(ViewPropsDiffTest, gradientColorHintEmitsNullColor) {
93+
expectPayloads({{dynamic::object(
94+
"backgroundImage",
95+
dynamic::array(
96+
dynamic::object("type", "linear-gradient")(
97+
"direction", dynamic::object("type", "angle")("value", 180))(
98+
"colorStops",
99+
dynamic::array(
100+
dynamic::object("color", kRed)("position", nullptr),
101+
dynamic::object("color", nullptr)("position", "20%"),
102+
dynamic::object("color", static_cast<int32_t>(0xFF0000FF))(
103+
"position", nullptr)))))}});
104+
}
105+
90106
} // namespace facebook::react
91107

92108
#endif

0 commit comments

Comments
 (0)