Skip to content

Commit 8d67a35

Browse files
committed
Adjust CPP implementation
1 parent 059b95e commit 8d67a35

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

packages/react-native-reanimated/Common/cpp/reanimated/CSS/common/values/CSSColor.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,11 @@ CSSColor::CSSColor(const folly::dynamic &value)
100100
}
101101

102102
bool CSSColor::canConstruct(jsi::Runtime &rt, const jsi::Value &jsiValue) {
103-
return jsiValue.isNumber() || jsiValue.isUndefined() ||
104-
(jsiValue.isString() && jsiValue.getString(rt).utf8(rt) == "transparent");
103+
return jsiValue.isNumber() || jsiValue.isNull();
105104
}
106105

107106
bool CSSColor::canConstruct(const folly::dynamic &value) {
108-
return value.isNumber() || value.empty() ||
109-
(value.isString() && value.getString() == "transparent");
107+
return value.isNumber() || value.isNull();
110108
}
111109

112110
folly::dynamic CSSColor::toDynamic() const {

packages/react-native-reanimated/Common/cpp/reanimated/CSS/svg/values/SVGBrush.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ SVGBrush::SVGBrush(const folly::dynamic &value)
2424
bool SVGBrush::canConstruct(jsi::Runtime &rt, const jsi::Value &jsiValue) {
2525
return jsiValue.isNumber() || jsiValue.isUndefined() ||
2626
(jsiValue.isString() &&
27-
isValidColorString(jsiValue.getString(rt).utf8(rt)));
27+
jsiValue.getString(rt).utf8(rt) == "currentColor");
2828
}
2929

3030
bool SVGBrush::canConstruct(const folly::dynamic &value) {
3131
return value.isNumber() || value.empty() ||
32-
isValidColorString(value.asString());
32+
value.asString() == "currentColor";
3333
}
3434

3535
folly::dynamic SVGBrush::toDynamic() const {
@@ -78,8 +78,4 @@ std::ostream &operator<<(std::ostream &os, const SVGBrush &colorValue) {
7878

7979
#endif // NDEBUG
8080

81-
bool SVGBrush::isValidColorString(const std::string &value) {
82-
return value == "transparent" || value == "currentColor";
83-
}
84-
8581
} // namespace reanimated::css

packages/react-native-reanimated/src/common/processors/shadows.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export const processBoxShadowNative: ValueProcessor<
5959
} = shadow;
6060
const processedColor = processColor(color);
6161

62-
if (processedColor === null) {
62+
if (processedColor === undefined) {
6363
throw new ReanimatedError(
6464
ERROR_MESSAGES.invalidColor(color, JSON.stringify(shadow))
6565
);

0 commit comments

Comments
 (0)