diff --git a/ReactCommon/react/renderer/components/view/ViewShadowNode.cpp b/ReactCommon/react/renderer/components/view/ViewShadowNode.cpp index 1dcbb084b3a4e2..029c3eaf8fc0c9 100644 --- a/ReactCommon/react/renderer/components/view/ViewShadowNode.cpp +++ b/ReactCommon/react/renderer/components/view/ViewShadowNode.cpp @@ -28,14 +28,6 @@ ViewShadowNode::ViewShadowNode( initialize(); } -static bool isColorMeaningful(SharedColor const &color) noexcept { - if (!color) { - return false; - } - - return colorComponentsFromColor(color).alpha > 0; -} - void ViewShadowNode::initialize() noexcept { auto &viewProps = static_cast(*props_); diff --git a/ReactCommon/react/renderer/graphics/platform/cxx/react/renderer/graphics/Color.cpp b/ReactCommon/react/renderer/graphics/platform/cxx/react/renderer/graphics/Color.cpp index 92b738e5b33f9c..e33c3ef32707da 100644 --- a/ReactCommon/react/renderer/graphics/platform/cxx/react/renderer/graphics/Color.cpp +++ b/ReactCommon/react/renderer/graphics/platform/cxx/react/renderer/graphics/Color.cpp @@ -10,6 +10,14 @@ namespace facebook { namespace react { +bool isColorMeaningful(SharedColor const &color) noexcept { + if (!color) { + return false; + } + + return colorComponentsFromColor(color).alpha > 0; +} + SharedColor colorFromComponents(ColorComponents components) { float ratio = 255; return SharedColor( diff --git a/ReactCommon/react/renderer/graphics/platform/cxx/react/renderer/graphics/Color.h b/ReactCommon/react/renderer/graphics/platform/cxx/react/renderer/graphics/Color.h index 5ab4dabd56874d..34c7f6f53f3eb8 100644 --- a/ReactCommon/react/renderer/graphics/platform/cxx/react/renderer/graphics/Color.h +++ b/ReactCommon/react/renderer/graphics/platform/cxx/react/renderer/graphics/Color.h @@ -59,6 +59,7 @@ class SharedColor { Color color_; }; +bool isColorMeaningful(SharedColor const &color) noexcept; SharedColor colorFromComponents(ColorComponents components); ColorComponents colorComponentsFromColor(SharedColor color); diff --git a/ReactCommon/react/renderer/graphics/platform/ios/Color.cpp b/ReactCommon/react/renderer/graphics/platform/ios/Color.cpp index 0b9bf45c56d4cd..4617555cdb2ce2 100644 --- a/ReactCommon/react/renderer/graphics/platform/ios/Color.cpp +++ b/ReactCommon/react/renderer/graphics/platform/ios/Color.cpp @@ -11,6 +11,14 @@ namespace facebook { namespace react { +bool isColorMeaningful(SharedColor const &color) noexcept { + if (!color) { + return false; + } + + return colorComponentsFromColor(color).alpha > 0; +} + SharedColor colorFromComponents(ColorComponents components) { float ratio = 255; return SharedColor( diff --git a/ReactCommon/react/renderer/graphics/platform/ios/Color.h b/ReactCommon/react/renderer/graphics/platform/ios/Color.h index e85a92fffac11e..bd57a2f9ba6cea 100644 --- a/ReactCommon/react/renderer/graphics/platform/ios/Color.h +++ b/ReactCommon/react/renderer/graphics/platform/ios/Color.h @@ -20,6 +20,7 @@ using Color = int32_t; using SharedColor = better::optional; +bool isColorMeaningful(SharedColor const &color) noexcept; SharedColor colorFromComponents(ColorComponents components); ColorComponents colorComponentsFromColor(SharedColor color);