diff --git a/ReactCommon/fabric/attributedstring/primitives.h b/ReactCommon/fabric/attributedstring/primitives.h index 84d30e1566b..a59024e53a6 100644 --- a/ReactCommon/fabric/attributedstring/primitives.h +++ b/ReactCommon/fabric/attributedstring/primitives.h @@ -7,6 +7,10 @@ #pragma once + +#include +#include + namespace facebook { namespace react { @@ -81,6 +85,7 @@ enum class TextDecorationLineStyle { Double }; + enum class TextDecorationLinePattern { Solid, Dot, @@ -89,6 +94,90 @@ enum class TextDecorationLinePattern { DashDotDot, }; + } // namespace react } // namespace facebook +namespace std +{ + template <> + struct hash + { + size_t operator()(const facebook::react::FontVariant& v) const + { + return hash()(static_cast(v)); + } + }; + + template <> + struct hash + { + size_t operator()(const facebook::react::TextAlignment& v) const + { + return hash()(static_cast(v)); + } + }; + + template <> + struct hash + { + size_t operator()(const facebook::react::FontStyle& v) const + { + return hash()(static_cast(v)); + } + }; + + template <> + struct hash + { + size_t operator()(const facebook::react::TextDecorationLineType& v) const + { + return hash()(static_cast(v)); + } + }; + + template <> + struct hash + { + size_t operator()(const facebook::react::WritingDirection& v) const + { + return hash()(static_cast(v)); + } + }; + + template <> + struct hash + { + size_t operator()(const facebook::react::TextDecorationLinePattern& v) const + { + return hash()(static_cast(v)); + } + }; + + template <> + struct hash + { + size_t operator()(const facebook::react::TextDecorationLineStyle& v) const + { + return hash()(static_cast(v)); + } + }; + + template <> + struct hash + { + size_t operator()(const facebook::react::FontWeight& v) const + { + return hash()(static_cast(v)); + } + }; + + template <> + struct hash + { + size_t operator()(const facebook::react::EllipsizeMode& v) const + { + return hash()(static_cast(v)); + } + }; +} diff --git a/ReactCommon/fabric/core/layout/LayoutPrimitives.h b/ReactCommon/fabric/core/layout/LayoutPrimitives.h index bce2bc46fdf..fc74187e823 100644 --- a/ReactCommon/fabric/core/layout/LayoutPrimitives.h +++ b/ReactCommon/fabric/core/layout/LayoutPrimitives.h @@ -7,6 +7,9 @@ #pragma once +#include +#include + namespace facebook { namespace react { @@ -31,3 +34,15 @@ enum class LayoutDirection { } // namespace react } // namespace facebook + +namespace std +{ + template <> + struct hash + { + size_t operator()(const facebook::react::LayoutDirection& v) const + { + return hash()(static_cast(v)); + } + }; +} diff --git a/ReactCommon/fabric/graphics/platform/android/Color.h b/ReactCommon/fabric/graphics/platform/android/Color.h index 69b13e76c78..3ae7d5cb8e8 100644 --- a/ReactCommon/fabric/graphics/platform/android/Color.h +++ b/ReactCommon/fabric/graphics/platform/android/Color.h @@ -7,6 +7,7 @@ #pragma once +#include #include #include @@ -58,3 +59,15 @@ ColorComponents colorComponentsFromColor(SharedColor color); } // namespace react } // namespace facebook + +namespace std +{ + template <> + struct hash + { + size_t operator()(const facebook::react::SharedColor& sharedColor) const + { + return hash{}(*sharedColor); + } + }; +}