From 120dcec621d6a474594fe8fe16ff15aaa5ea127a Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Mon, 14 May 2018 15:43:54 -0700 Subject: [PATCH] Fabric: New props treatment in `core` module Summary: Same as previous one. Adopting template-generated `convertRawProp` and `debugStringConvertibleItem` functions in `core` module. Note, to do so we have to change signatures of some conversions functions to make them more overloading-friendly. Reviewed By: fkgozali Differential Revision: D7958243 fbshipit-source-id: 500ee420d9aa562ee3c5810ef625e06541eda8fb --- .../attributedstring/ParagraphAttributes.cpp | 1 + .../attributedstring/TextAttributes.cpp | 4 +++- ...ayoutValuesConversions.h => conversions.h} | 4 ++-- .../fabric/core/debugStringConvertibleUtils.h | 20 ------------------- .../core/{shadownode => }/propsConversions.h | 0 5 files changed, 6 insertions(+), 23 deletions(-) rename ReactCommon/fabric/core/{layout/layoutValuesConversions.h => conversions.h} (80%) delete mode 100644 ReactCommon/fabric/core/debugStringConvertibleUtils.h rename ReactCommon/fabric/core/{shadownode => }/propsConversions.h (100%) diff --git a/ReactCommon/fabric/attributedstring/ParagraphAttributes.cpp b/ReactCommon/fabric/attributedstring/ParagraphAttributes.cpp index f3382a54d4..53550b6db4 100644 --- a/ReactCommon/fabric/attributedstring/ParagraphAttributes.cpp +++ b/ReactCommon/fabric/attributedstring/ParagraphAttributes.cpp @@ -8,6 +8,7 @@ #include "ParagraphAttributes.h" #include +#include #include namespace facebook { diff --git a/ReactCommon/fabric/attributedstring/TextAttributes.cpp b/ReactCommon/fabric/attributedstring/TextAttributes.cpp index 66e1f02b90..93e3162508 100644 --- a/ReactCommon/fabric/attributedstring/TextAttributes.cpp +++ b/ReactCommon/fabric/attributedstring/TextAttributes.cpp @@ -8,8 +8,10 @@ #include "TextAttributes.h" #include +#include #include -#include + +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/layout/layoutValuesConversions.h b/ReactCommon/fabric/core/conversions.h similarity index 80% rename from ReactCommon/fabric/core/layout/layoutValuesConversions.h rename to ReactCommon/fabric/core/conversions.h index dc821a35fa..1d058558df 100644 --- a/ReactCommon/fabric/core/layout/layoutValuesConversions.h +++ b/ReactCommon/fabric/core/conversions.h @@ -12,7 +12,7 @@ namespace facebook { namespace react { -inline std::string stringFromLayoutDirection(const LayoutDirection &layoutDirection) { +inline std::string toString(const LayoutDirection &layoutDirection) { switch (layoutDirection) { case LayoutDirection::Undefined: return "undefined"; case LayoutDirection::LeftToRight: return "ltr"; @@ -20,7 +20,7 @@ inline std::string stringFromLayoutDirection(const LayoutDirection &layoutDirect } } -inline std::string stringFromDisplayType(const DisplayType &displayType) { +inline std::string toString(const DisplayType &displayType) { switch (displayType) { case DisplayType::None: return "none"; case DisplayType::Flex: return "flex"; diff --git a/ReactCommon/fabric/core/debugStringConvertibleUtils.h b/ReactCommon/fabric/core/debugStringConvertibleUtils.h deleted file mode 100644 index 0dc60ea89b..0000000000 --- a/ReactCommon/fabric/core/debugStringConvertibleUtils.h +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -namespace facebook { -namespace react { - -DEBUG_STRING_CONVERTIBLE_TEMPLATE(LayoutDirection, stringFromLayoutDirection) -DEBUG_STRING_CONVERTIBLE_TEMPLATE(DisplayType, stringFromDisplayType) - -} // namespace react -} // namespace facebook diff --git a/ReactCommon/fabric/core/shadownode/propsConversions.h b/ReactCommon/fabric/core/propsConversions.h similarity index 100% rename from ReactCommon/fabric/core/shadownode/propsConversions.h rename to ReactCommon/fabric/core/propsConversions.h