diff --git a/ReactCommon/fabric/attributedstring/conversions.h b/ReactCommon/fabric/attributedstring/conversions.h index 9cbc4367f..ffec2ea89 100644 --- a/ReactCommon/fabric/attributedstring/conversions.h +++ b/ReactCommon/fabric/attributedstring/conversions.h @@ -375,6 +375,8 @@ inline std::string toString( } } +#ifdef ANDROID + inline folly::dynamic toDynamic( const ParagraphAttributes ¶graphAttributes) { auto values = folly::dynamic::object(); @@ -490,5 +492,7 @@ inline folly::dynamic toDynamic(const AttributedString &attributedString) { return value; } +#endif + } // namespace react } // namespace facebook diff --git a/ReactCommon/fabric/attributedstring/tests/AttributedStringTest.cpp b/ReactCommon/fabric/attributedstring/tests/AttributedStringTest.cpp index 1b9205d66..3560d6164 100644 --- a/ReactCommon/fabric/attributedstring/tests/AttributedStringTest.cpp +++ b/ReactCommon/fabric/attributedstring/tests/AttributedStringTest.cpp @@ -17,6 +17,8 @@ namespace facebook { namespace react { +#ifdef ANDROID + TEST(AttributedStringTest, testToDynamic) { auto attString = new AttributedString(); auto fragment = new AttributedString::Fragment(); @@ -42,5 +44,7 @@ TEST(AttributedStringTest, testToDynamic) { assert(textAttribute["fontWeight"] == toString(*text->fontWeight)); } +#endif + } // namespace react } // namespace facebook diff --git a/ReactCommon/fabric/attributedstring/tests/ParagraphAttributesTest.cpp b/ReactCommon/fabric/attributedstring/tests/ParagraphAttributesTest.cpp index f2ba374ef..fb3e1c343 100644 --- a/ReactCommon/fabric/attributedstring/tests/ParagraphAttributesTest.cpp +++ b/ReactCommon/fabric/attributedstring/tests/ParagraphAttributesTest.cpp @@ -16,6 +16,8 @@ namespace facebook { namespace react { +#ifdef ANDROID + TEST(ParagraphAttributesTest, testToDynamic) { auto paragraphAttributes = ParagraphAttributes(); paragraphAttributes.maximumNumberOfLines = 2; @@ -33,5 +35,7 @@ TEST(ParagraphAttributesTest, testToDynamic) { result["ellipsizeMode"] == toString(paragraphAttributes.ellipsizeMode)); } +#endif + } // namespace react } // namespace facebook diff --git a/ReactCommon/fabric/attributedstring/tests/TextAttributesTest.cpp b/ReactCommon/fabric/attributedstring/tests/TextAttributesTest.cpp index c029c6649..5b559230a 100644 --- a/ReactCommon/fabric/attributedstring/tests/TextAttributesTest.cpp +++ b/ReactCommon/fabric/attributedstring/tests/TextAttributesTest.cpp @@ -17,6 +17,8 @@ namespace facebook { namespace react { +#ifdef ANDROID + TEST(TextAttributesTest, testToDynamic) { auto text = TextAttributes(); text.foregroundColor = { @@ -33,5 +35,7 @@ TEST(TextAttributesTest, testToDynamic) { assert(result["fontWeight"] == toString(*text.fontWeight)); } +#endif + } // namespace react } // namespace facebook diff --git a/ReactCommon/fabric/components/text/paragraph/ParagraphLocalData.cpp b/ReactCommon/fabric/components/text/paragraph/ParagraphLocalData.cpp index 2c562ea30..fb9426da9 100644 --- a/ReactCommon/fabric/components/text/paragraph/ParagraphLocalData.cpp +++ b/ReactCommon/fabric/components/text/paragraph/ParagraphLocalData.cpp @@ -33,10 +33,14 @@ void ParagraphLocalData::setTextLayoutManager( textLayoutManager_ = textLayoutManager; } +#ifdef ANDROID + folly::dynamic ParagraphLocalData::getDynamic() const { return toDynamic(*this); } +#endif + #pragma mark - DebugStringConvertible #if RN_DEBUG_STRING_CONVERTIBLE diff --git a/ReactCommon/fabric/components/text/paragraph/ParagraphLocalData.h b/ReactCommon/fabric/components/text/paragraph/ParagraphLocalData.h index 7005496f9..15e370573 100644 --- a/ReactCommon/fabric/components/text/paragraph/ParagraphLocalData.h +++ b/ReactCommon/fabric/components/text/paragraph/ParagraphLocalData.h @@ -38,7 +38,9 @@ class ParagraphLocalData : public LocalData { SharedTextLayoutManager getTextLayoutManager() const; void setTextLayoutManager(SharedTextLayoutManager textLayoutManager); +#ifdef ANDROID folly::dynamic getDynamic() const override; +#endif #pragma mark - DebugStringConvertible diff --git a/ReactCommon/fabric/components/text/paragraph/conversions.h b/ReactCommon/fabric/components/text/paragraph/conversions.h index 996251c19..dd507cefa 100644 --- a/ReactCommon/fabric/components/text/paragraph/conversions.h +++ b/ReactCommon/fabric/components/text/paragraph/conversions.h @@ -10,6 +10,8 @@ namespace facebook { namespace react { +#ifdef ANDROID + inline folly::dynamic toDynamic(const ParagraphLocalData ¶graphLocalData) { folly::dynamic newLocalData = folly::dynamic::object(); newLocalData["attributedString"] = @@ -18,5 +20,7 @@ inline folly::dynamic toDynamic(const ParagraphLocalData ¶graphLocalData) { return newLocalData; } +#endif + } // namespace react } // namespace facebook diff --git a/ReactCommon/fabric/components/text/tests/ParagraphLocalDataTest.cpp b/ReactCommon/fabric/components/text/tests/ParagraphLocalDataTest.cpp index fab50b266..accf32c0b 100644 --- a/ReactCommon/fabric/components/text/tests/ParagraphLocalDataTest.cpp +++ b/ReactCommon/fabric/components/text/tests/ParagraphLocalDataTest.cpp @@ -18,6 +18,8 @@ namespace facebook { namespace react { +#ifdef ANDROID + TEST(ParagraphLocalDataTest, testSomething) { auto attString = AttributedString(); auto fragment = AttributedString::Fragment(); @@ -46,5 +48,7 @@ TEST(ParagraphLocalDataTest, testSomething) { assert(textAttribute["fontWeight"] == toString(*text.fontWeight)); } +#endif + } // namespace react } // namespace facebook diff --git a/ReactCommon/fabric/graphics/conversions.h b/ReactCommon/fabric/graphics/conversions.h index aa847b933..8ff2bd26f 100644 --- a/ReactCommon/fabric/graphics/conversions.h +++ b/ReactCommon/fabric/graphics/conversions.h @@ -43,6 +43,8 @@ inline void fromDynamic(const folly::dynamic &value, SharedColor &result) { result = colorFromComponents({red, green, blue, alpha}); } +#ifdef ANDROID + inline folly::dynamic toDynamic(const SharedColor &color) { ColorComponents components = colorComponentsFromColor(color); auto ratio = 256.f; @@ -53,6 +55,8 @@ inline folly::dynamic toDynamic(const SharedColor &color) { ((int)(components.blue * ratio) & 0xff)); } +#endif + inline std::string toString(const SharedColor &value) { ColorComponents components = colorComponentsFromColor(value); auto ratio = 256.f;