Skip to content

Commit 2332cb6

Browse files
sherginfacebook-github-bot
authored andcommitted
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
1 parent 94925d5 commit 2332cb6

File tree

9 files changed

+34
-0
lines changed

9 files changed

+34
-0
lines changed

ReactCommon/fabric/attributedstring/conversions.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,8 @@ inline std::string toString(
375375
}
376376
}
377377

378+
#ifdef ANDROID
379+
378380
inline folly::dynamic toDynamic(
379381
const ParagraphAttributes &paragraphAttributes) {
380382
auto values = folly::dynamic::object();
@@ -490,5 +492,7 @@ inline folly::dynamic toDynamic(const AttributedString &attributedString) {
490492
return value;
491493
}
492494

495+
#endif
496+
493497
} // namespace react
494498
} // namespace facebook

ReactCommon/fabric/attributedstring/tests/AttributedStringTest.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
namespace facebook {
1818
namespace react {
1919

20+
#ifdef ANDROID
21+
2022
TEST(AttributedStringTest, testToDynamic) {
2123
auto attString = new AttributedString();
2224
auto fragment = new AttributedString::Fragment();
@@ -42,5 +44,7 @@ TEST(AttributedStringTest, testToDynamic) {
4244
assert(textAttribute["fontWeight"] == toString(*text->fontWeight));
4345
}
4446

47+
#endif
48+
4549
} // namespace react
4650
} // namespace facebook

ReactCommon/fabric/attributedstring/tests/ParagraphAttributesTest.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
namespace facebook {
1717
namespace react {
1818

19+
#ifdef ANDROID
20+
1921
TEST(ParagraphAttributesTest, testToDynamic) {
2022
auto paragraphAttributes = ParagraphAttributes();
2123
paragraphAttributes.maximumNumberOfLines = 2;
@@ -33,5 +35,7 @@ TEST(ParagraphAttributesTest, testToDynamic) {
3335
result["ellipsizeMode"] == toString(paragraphAttributes.ellipsizeMode));
3436
}
3537

38+
#endif
39+
3640
} // namespace react
3741
} // namespace facebook

ReactCommon/fabric/attributedstring/tests/TextAttributesTest.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
namespace facebook {
1818
namespace react {
1919

20+
#ifdef ANDROID
21+
2022
TEST(TextAttributesTest, testToDynamic) {
2123
auto text = TextAttributes();
2224
text.foregroundColor = {
@@ -33,5 +35,7 @@ TEST(TextAttributesTest, testToDynamic) {
3335
assert(result["fontWeight"] == toString(*text.fontWeight));
3436
}
3537

38+
#endif
39+
3640
} // namespace react
3741
} // namespace facebook

ReactCommon/fabric/components/text/paragraph/ParagraphLocalData.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,14 @@ void ParagraphLocalData::setTextLayoutManager(
3333
textLayoutManager_ = textLayoutManager;
3434
}
3535

36+
#ifdef ANDROID
37+
3638
folly::dynamic ParagraphLocalData::getDynamic() const {
3739
return toDynamic(*this);
3840
}
3941

42+
#endif
43+
4044
#pragma mark - DebugStringConvertible
4145

4246
#if RN_DEBUG_STRING_CONVERTIBLE

ReactCommon/fabric/components/text/paragraph/ParagraphLocalData.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ class ParagraphLocalData : public LocalData {
3838
SharedTextLayoutManager getTextLayoutManager() const;
3939
void setTextLayoutManager(SharedTextLayoutManager textLayoutManager);
4040

41+
#ifdef ANDROID
4142
folly::dynamic getDynamic() const override;
43+
#endif
4244

4345
#pragma mark - DebugStringConvertible
4446

ReactCommon/fabric/components/text/paragraph/conversions.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
namespace facebook {
1111
namespace react {
1212

13+
#ifdef ANDROID
14+
1315
inline folly::dynamic toDynamic(const ParagraphLocalData &paragraphLocalData) {
1416
folly::dynamic newLocalData = folly::dynamic::object();
1517
newLocalData["attributedString"] =
@@ -18,5 +20,7 @@ inline folly::dynamic toDynamic(const ParagraphLocalData &paragraphLocalData) {
1820
return newLocalData;
1921
}
2022

23+
#endif
24+
2125
} // namespace react
2226
} // namespace facebook

ReactCommon/fabric/components/text/tests/ParagraphLocalDataTest.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
namespace facebook {
1919
namespace react {
2020

21+
#ifdef ANDROID
22+
2123
TEST(ParagraphLocalDataTest, testSomething) {
2224
auto attString = AttributedString();
2325
auto fragment = AttributedString::Fragment();
@@ -46,5 +48,7 @@ TEST(ParagraphLocalDataTest, testSomething) {
4648
assert(textAttribute["fontWeight"] == toString(*text.fontWeight));
4749
}
4850

51+
#endif
52+
4953
} // namespace react
5054
} // namespace facebook

ReactCommon/fabric/graphics/conversions.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ inline void fromDynamic(const folly::dynamic &value, SharedColor &result) {
4343
result = colorFromComponents({red, green, blue, alpha});
4444
}
4545

46+
#ifdef ANDROID
47+
4648
inline folly::dynamic toDynamic(const SharedColor &color) {
4749
ColorComponents components = colorComponentsFromColor(color);
4850
auto ratio = 256.f;
@@ -53,6 +55,8 @@ inline folly::dynamic toDynamic(const SharedColor &color) {
5355
((int)(components.blue * ratio) & 0xff));
5456
}
5557

58+
#endif
59+
5660
inline std::string toString(const SharedColor &value) {
5761
ColorComponents components = colorComponentsFromColor(value);
5862
auto ratio = 256.f;

0 commit comments

Comments
 (0)