mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-01-12 22:50:10 +08:00
Fabric: A bunch of #ifdef ANDROID
Summary: Nothing really changed; the change is only to better express an original intent. Reviewed By: JoshuaGross Differential Revision: D13962464 fbshipit-source-id: f385db8ba8662f2150181e47fc6a2a981f809e96
This commit is contained in:
committed by
Facebook Github Bot
parent
94925d5eb7
commit
2332cb6fe2
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user