Skip to content

Commit 0144798

Browse files
Nick Lefeverfacebook-github-bot
authored andcommitted
Move toDynamic conversion for BoxShadow (facebook#52536)
Summary: Pull Request resolved: facebook#52536 See title Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D78005880 fbshipit-source-id: 5a4b7ff3c4d9c6ece17759926ee80aec80d3cde0
1 parent 263ccad commit 0144798

File tree

2 files changed

+20
-15
lines changed

2 files changed

+20
-15
lines changed

packages/react-native/ReactCommon/react/renderer/components/view/platform/android/react/renderer/components/view/HostPlatformViewProps.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -491,21 +491,6 @@ inline static void updateAccessibilityStateProp(
491491
result["accessibilityState"] = resultState;
492492
}
493493

494-
static folly::dynamic toDynamic(const std::vector<BoxShadow>& boxShadow) {
495-
folly::dynamic boxShadowResult = folly::dynamic::array();
496-
for (const auto& boxShadowValue : boxShadow) {
497-
folly::dynamic boxShadowValueResult = folly::dynamic::object();
498-
boxShadowValueResult["offsetX"] = boxShadowValue.offsetX;
499-
boxShadowValueResult["offsetY"] = boxShadowValue.offsetY;
500-
boxShadowValueResult["blurRadius"] = boxShadowValue.blurRadius;
501-
boxShadowValueResult["spreadDistance"] = boxShadowValue.spreadDistance;
502-
boxShadowValueResult["color"] = *boxShadowValue.color;
503-
boxShadowValueResult["inset"] = boxShadowValue.inset;
504-
boxShadowResult.push_back(boxShadowValueResult);
505-
}
506-
return boxShadowResult;
507-
}
508-
509494
static folly::dynamic toDynamic(const std::vector<FilterFunction>& filter) {
510495
folly::dynamic filterResult = folly::dynamic::array();
511496
for (const auto& filterFunction : filter) {

packages/react-native/ReactCommon/react/renderer/graphics/BoxShadow.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,25 @@ struct BoxShadow {
2121
Float spreadDistance{};
2222
SharedColor color{};
2323
bool inset{};
24+
25+
#ifdef RN_SERIALIZABLE_STATE
26+
folly::dynamic toDynamic() const {
27+
folly::dynamic result = folly::dynamic::object();
28+
result["offsetX"] = offsetX;
29+
result["offsetY"] = offsetY;
30+
result["blurRadius"] = blurRadius;
31+
result["spreadDistance"] = spreadDistance;
32+
result["color"] = *color;
33+
result["inset"] = inset;
34+
return result;
35+
}
36+
#endif
2437
};
38+
39+
#ifdef RN_SERIALIZABLE_STATE
40+
inline folly::dynamic toDynamic(const BoxShadow& boxShadow) {
41+
return boxShadow.toDynamic();
42+
}
43+
#endif
44+
2545
} // namespace facebook::react

0 commit comments

Comments
 (0)