diff --git a/ReactCommon/fabric/attributedstring/BUCK b/ReactCommon/fabric/attributedstring/BUCK index 625639db36efd2..e6aa5bab556716 100644 --- a/ReactCommon/fabric/attributedstring/BUCK +++ b/ReactCommon/fabric/attributedstring/BUCK @@ -1,5 +1,5 @@ -load("//configurations/buck/apple:flag_defs.bzl", "get_debug_preprocessor_flags") -load("//ReactNative:DEFS.bzl", "IS_OSS_BUILD", "react_native_xplat_target", "rn_xplat_cxx_library", "get_apple_inspector_flags", "APPLE") +load("//configurations/buck/apple:flag_defs.bzl", "get_application_ios_flags", "get_debug_preprocessor_flags", "OBJC_ARC_PREPROCESSOR_FLAGS") +load("//ReactNative:DEFS.bzl", "IS_OSS_BUILD", "rn_xplat_cxx_library", "get_apple_inspector_flags", "react_native_xplat_target", "ANDROID", "APPLE") APPLE_COMPILER_FLAGS = [] @@ -37,6 +37,7 @@ rn_xplat_cxx_library( ], force_static = True, macosx_tests_override = [], + platforms = (ANDROID, APPLE), preprocessor_flags = [ "-DLOG_TAG=\"ReactNative\"", "-DWITH_FBSYSTRACE=1", diff --git a/ReactCommon/fabric/core/BUCK b/ReactCommon/fabric/core/BUCK index 981dd874f40045..4c732efc470eb7 100644 --- a/ReactCommon/fabric/core/BUCK +++ b/ReactCommon/fabric/core/BUCK @@ -1,5 +1,5 @@ -load("//configurations/buck/apple:flag_defs.bzl", "get_debug_preprocessor_flags") -load("//ReactNative:DEFS.bzl", "IS_OSS_BUILD", "react_native_xplat_target", "rn_xplat_cxx_library", "get_apple_inspector_flags", "APPLE") +load("//configurations/buck/apple:flag_defs.bzl", "get_application_ios_flags", "get_debug_preprocessor_flags", "OBJC_ARC_PREPROCESSOR_FLAGS") +load("//ReactNative:DEFS.bzl", "IS_OSS_BUILD", "rn_xplat_cxx_library", "get_apple_inspector_flags", "react_native_xplat_target", "ANDROID", "APPLE") APPLE_COMPILER_FLAGS = [] @@ -40,6 +40,7 @@ rn_xplat_cxx_library( ], force_static = True, macosx_tests_override = [], + platforms = (ANDROID, APPLE), preprocessor_flags = [ "-DLOG_TAG=\"ReactNative\"", "-DWITH_FBSYSTRACE=1", diff --git a/ReactCommon/fabric/debug/BUCK b/ReactCommon/fabric/debug/BUCK index 782b7452253f47..41fe3bcc5c77ec 100644 --- a/ReactCommon/fabric/debug/BUCK +++ b/ReactCommon/fabric/debug/BUCK @@ -1,11 +1,11 @@ -load("@xplat//configurations/buck/apple:flag_defs.bzl", "get_debug_preprocessor_flags") -load("//ReactNative:DEFS.bzl", "IS_OSS_BUILD", "react_native_xplat_target", "rn_xplat_cxx_library", "get_apple_inspector_flags", "APPLE") +load("//configurations/buck/apple:flag_defs.bzl", "get_application_ios_flags", "get_debug_preprocessor_flags", "OBJC_ARC_PREPROCESSOR_FLAGS") +load("//ReactNative:DEFS.bzl", "IS_OSS_BUILD", "rn_xplat_cxx_library", "get_apple_inspector_flags", "react_native_xplat_target", "ANDROID", "APPLE") APPLE_COMPILER_FLAGS = [] if not IS_OSS_BUILD: load("@xplat//configurations/buck/apple:flag_defs.bzl", "get_static_library_ios_flags", "flags") - APPLE_COMPILER_FLAGS = flags.get_flag_value(get_static_library_ios_flags(), "compiler_flags") + APPLE_COMPILER_FLAGS = flags.get_flag_value(get_static_library_ios_flags(), 'compiler_flags') rn_xplat_cxx_library( name = "debug", @@ -37,6 +37,7 @@ rn_xplat_cxx_library( ], force_static = True, macosx_tests_override = [], + platforms = (ANDROID, APPLE), preprocessor_flags = [ "-DLOG_TAG=\"ReactNative\"", "-DWITH_FBSYSTRACE=1", @@ -44,7 +45,10 @@ rn_xplat_cxx_library( tests = [], visibility = ["PUBLIC"], deps = [ + "xplat//fbsystrace:fbsystrace", "xplat//folly:headers_only", + "xplat//folly:memory", + "xplat//folly:molly", ], ) diff --git a/ReactCommon/fabric/graphics/BUCK b/ReactCommon/fabric/graphics/BUCK index 52a42e39208fa5..2cd6abacfdf0d9 100644 --- a/ReactCommon/fabric/graphics/BUCK +++ b/ReactCommon/fabric/graphics/BUCK @@ -1,5 +1,5 @@ -load("//configurations/buck/apple:flag_defs.bzl", "get_debug_preprocessor_flags") -load("//ReactNative:DEFS.bzl", "IS_OSS_BUILD", "react_native_xplat_target", "rn_xplat_cxx_library", "get_apple_inspector_flags", "APPLE") +load("//configurations/buck/apple:flag_defs.bzl", "get_application_ios_flags", "get_debug_preprocessor_flags", "OBJC_ARC_PREPROCESSOR_FLAGS") +load("//ReactNative:DEFS.bzl", "IS_OSS_BUILD", "rn_xplat_cxx_library", "get_apple_inspector_flags", "react_native_xplat_target", "ANDROID", "APPLE") APPLE_COMPILER_FLAGS = [] @@ -25,10 +25,10 @@ rn_xplat_cxx_library( prefix = "fabric/graphics", ), compiler_flags = [ - "-std=c++14", - "-Wall", "-fexceptions", "-frtti", + "-std=c++14", + "-Wall", ], fbobjc_compiler_flags = APPLE_COMPILER_FLAGS, fbobjc_preprocessor_flags = get_debug_preprocessor_flags() + get_apple_inspector_flags(), @@ -36,7 +36,13 @@ rn_xplat_cxx_library( ":tests", ], force_static = True, + frameworks = [ + "$SDKROOT/System/Library/Frameworks/CoreGraphics.framework", + "$SDKROOT/System/Library/Frameworks/Foundation.framework", + "$SDKROOT/System/Library/Frameworks/UIKit.framework", + ], macosx_tests_override = [], + platforms = (ANDROID, APPLE), preprocessor_flags = [ "-DLOG_TAG=\"ReactNative\"", "-DWITH_FBSYSTRACE=1", diff --git a/ReactCommon/fabric/text/BUCK b/ReactCommon/fabric/text/BUCK index 04fbad8d174971..9ee6fca05f03f9 100644 --- a/ReactCommon/fabric/text/BUCK +++ b/ReactCommon/fabric/text/BUCK @@ -21,6 +21,7 @@ rn_xplat_cxx_library( exported_headers = subdir_glob( [ ("", "*.h"), + ("basetext", "*.h"), ("paragraph", "*.h"), ("text", "*.h"), ("rawtext", "*.h"), diff --git a/ReactCommon/fabric/text/basetext/BaseTextProps.cpp b/ReactCommon/fabric/text/basetext/BaseTextProps.cpp new file mode 100644 index 00000000000000..4b3e1a80e5ff00 --- /dev/null +++ b/ReactCommon/fabric/text/basetext/BaseTextProps.cpp @@ -0,0 +1,73 @@ +/** + * 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. + */ + +#include "BaseTextProps.h" + +#include +#include +#include +#include +#include + +namespace facebook { +namespace react { + +void BaseTextProps::apply(const RawProps &rawProps) { + // Color + applyRawProp(rawProps, "color", textAttributes_.foregroundColor); + applyRawProp(rawProps, "backgroundColor", textAttributes_.backgroundColor); + applyRawProp(rawProps, "opacity", textAttributes_.opacity); + + // Font + applyRawProp(rawProps, "fontFamily", textAttributes_.fontFamily); + applyRawProp(rawProps, "fontSize", textAttributes_.fontSize); + applyRawProp(rawProps, "fontSizeMultiplier", textAttributes_.fontSizeMultiplier); + applyRawProp(rawProps, "fontWeight", textAttributes_.fontWeight); + applyRawProp(rawProps, "fontStyle", textAttributes_.fontStyle); + applyRawProp(rawProps, "fontVariant", textAttributes_.fontVariant); + applyRawProp(rawProps, "allowFontScaling", textAttributes_.allowFontScaling); + applyRawProp(rawProps, "letterSpacing", textAttributes_.letterSpacing); + + // Paragraph + applyRawProp(rawProps, "lineHeight", textAttributes_.lineHeight); + applyRawProp(rawProps, "alignment", textAttributes_.alignment); + applyRawProp(rawProps, "baseWritingDirection", textAttributes_.baseWritingDirection); + + // Decoration + applyRawProp(rawProps, "textDecorationColor", textAttributes_.textDecorationColor); + applyRawProp(rawProps, "textDecorationLineType", textAttributes_.textDecorationLineType); + applyRawProp(rawProps, "textDecorationLineStyle", textAttributes_.textDecorationLineStyle); + applyRawProp(rawProps, "textDecorationLinePattern", textAttributes_.textDecorationLinePattern); + + // Shadow + applyRawProp(rawProps, "textShadowOffset", textAttributes_.textShadowOffset); + applyRawProp(rawProps, "textShadowRadius", textAttributes_.textShadowRadius); + applyRawProp(rawProps, "textShadowColor", textAttributes_.textShadowColor); + + // Special + applyRawProp(rawProps, "isHighlighted", textAttributes_.isHighlighted); +} + +#pragma mark - Getters + +TextAttributes BaseTextProps::getTextAttributes() const { + return textAttributes_; +} + +#pragma mark - DebugStringConvertible + +SharedDebugStringConvertibleList BaseTextProps::getDebugProps() const { + SharedDebugStringConvertibleList list = {}; + + auto textAttributesPropsList = textAttributes_.getDebugProps(); + std::move(textAttributesPropsList.begin(), textAttributesPropsList.end(), std::back_inserter(list)); + + return list; +} + +} // namespace react +} // namespace facebook diff --git a/ReactCommon/fabric/text/basetext/BaseTextProps.h b/ReactCommon/fabric/text/basetext/BaseTextProps.h new file mode 100644 index 00000000000000..9d3909a3b354b8 --- /dev/null +++ b/ReactCommon/fabric/text/basetext/BaseTextProps.h @@ -0,0 +1,48 @@ +/** + * 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 +#include +#include + +namespace facebook { +namespace react { + +/* + * `Props`-like class which is used as a base class for all Props classes + * that can have text attributes (such as Text and Paragraph). + */ +class BaseTextProps { +public: + + /* + * Same semantic as `Props::apply(...)`. + */ + void apply(const RawProps &rawProps); + +#pragma mark - Getters + + /* + * Returns all props values as `TextAttributes` object. + */ + TextAttributes getTextAttributes() const; + +#pragma mark - DebugStringConvertible (partially) + + SharedDebugStringConvertibleList getDebugProps() const; + +private: + + TextAttributes textAttributes_; +}; + +} // namespace react +} // namespace facebook + diff --git a/ReactCommon/fabric/text/basetext/BaseTextShadowNode.cpp b/ReactCommon/fabric/text/basetext/BaseTextShadowNode.cpp new file mode 100644 index 00000000000000..f37f534b880d49 --- /dev/null +++ b/ReactCommon/fabric/text/basetext/BaseTextShadowNode.cpp @@ -0,0 +1,59 @@ +/** + * 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. + */ + +#include "BaseTextShadowNode.h" + +#include + +#include "RawTextShadowNode.h" +#include "RawTextProps.h" +#include "TextShadowNode.h" +#include "TextProps.h" + +namespace facebook { +namespace react { + +AttributedString BaseTextShadowNode::getAttributedString( + const TextAttributes &textAttributes, + const SharedShadowNodeSharedList &childNodes +) const { + // TODO: Implement caching. + + AttributedString attributedString; + + for (auto &&childNode : *childNodes) { + // RawShadowNode + SharedRawTextShadowNode rawTextShadowNode = std::dynamic_pointer_cast(childNode); + if (rawTextShadowNode) { + AttributedString::Fragment fragment; + fragment.string = rawTextShadowNode->getProps()->getText(); + fragment.textAttributes = textAttributes; + attributedString.appendFragment(fragment); + continue; + } + + // TextShadowNode + SharedTextShadowNode textShadowNode = std::dynamic_pointer_cast(childNode); + if (textShadowNode) { + TextAttributes localTextAttributes = textAttributes; + localTextAttributes.apply(textShadowNode->getProps()->getTextAttributes()); + attributedString.appendAttributedString(textShadowNode->getAttributedString(localTextAttributes, textShadowNode->getChildren())); + continue; + } + + // Any other kind of ShadowNode + AttributedString::Fragment fragment; + fragment.shadowNode = childNode; + fragment.textAttributes = textAttributes; + attributedString.appendFragment(fragment); + } + + return attributedString; +} + +} // namespace react +} // namespace facebook diff --git a/ReactCommon/fabric/text/basetext/BaseTextShadowNode.h b/ReactCommon/fabric/text/basetext/BaseTextShadowNode.h new file mode 100644 index 00000000000000..9d52b9c5ebe921 --- /dev/null +++ b/ReactCommon/fabric/text/basetext/BaseTextShadowNode.h @@ -0,0 +1,33 @@ +/** + * 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 { + +/* + * Base class (one of) for shadow nodes that represents attributed text, + * such as Text and Paragraph (but not RawText). + */ +class BaseTextShadowNode { +public: + + /* + * Returns a `AttributedString` which represents text content of the node. + */ + AttributedString getAttributedString( + const TextAttributes &baseTextAttributes, + const SharedShadowNodeSharedList &childNodes + ) const; +}; + +} // namespace react +} // namespace facebook diff --git a/ReactCommon/fabric/text/paragraph/ParagraphProps.cpp b/ReactCommon/fabric/text/paragraph/ParagraphProps.cpp index 89faa944565a04..95be162bb5a78d 100644 --- a/ReactCommon/fabric/text/paragraph/ParagraphProps.cpp +++ b/ReactCommon/fabric/text/paragraph/ParagraphProps.cpp @@ -17,6 +17,7 @@ namespace react { void ParagraphProps::apply(const RawProps &rawProps) { ViewProps::apply(rawProps); + BaseTextProps::apply(rawProps); // Paragraph Attributes applyRawProp(rawProps, "numberOfLines", paragraphAttributes_.maximumNumberOfLines); @@ -44,13 +45,17 @@ bool ParagraphProps::getIsSelectable() const { SharedDebugStringConvertibleList ParagraphProps::getDebugProps() const { SharedDebugStringConvertibleList list = {}; + // View Props + auto &&viewPropsList = ViewProps::getDebugProps(); + std::move(viewPropsList.begin(), viewPropsList.end(), std::back_inserter(list)); + // Paragraph Props auto &¶graphAttributePropsList = paragraphAttributes_.getDebugProps(); std::move(paragraphAttributePropsList.begin(), paragraphAttributePropsList.end(), std::back_inserter(list)); - // View Props - auto &&viewPropsList = ViewProps::getDebugProps(); - std::move(viewPropsList.begin(), viewPropsList.end(), std::back_inserter(list)); + // Base Text Props + auto &&baseTextPropsList = BaseTextProps::getDebugProps(); + std::move(baseTextPropsList.begin(), baseTextPropsList.end(), std::back_inserter(list)); return list; } diff --git a/ReactCommon/fabric/text/paragraph/ParagraphProps.h b/ReactCommon/fabric/text/paragraph/ParagraphProps.h index 42d630f04d0f98..4918f47b978727 100644 --- a/ReactCommon/fabric/text/paragraph/ParagraphProps.h +++ b/ReactCommon/fabric/text/paragraph/ParagraphProps.h @@ -12,6 +12,7 @@ #include #include +#include #include namespace facebook { @@ -27,7 +28,8 @@ using SharedParagraphProps = std::shared_ptr; * object. */ class ParagraphProps: - public ViewProps { + public ViewProps, + public BaseTextProps { public: diff --git a/ReactCommon/fabric/text/paragraph/ParagraphShadowNode.cpp b/ReactCommon/fabric/text/paragraph/ParagraphShadowNode.cpp index 76e90f9b9bcaca..57d13d7ed66f2c 100644 --- a/ReactCommon/fabric/text/paragraph/ParagraphShadowNode.cpp +++ b/ReactCommon/fabric/text/paragraph/ParagraphShadowNode.cpp @@ -17,17 +17,9 @@ namespace react { ComponentName ParagraphShadowNode::getComponentName() const { return ComponentName("Paragraph"); } - -SharedTextShadowNode ParagraphShadowNode::getTextChildNode() const { - // component must always have a single child component. - assert(getChildren()->size() == 1); - auto childNode = getChildren()->front(); - assert(std::dynamic_pointer_cast(childNode)); - return std::static_pointer_cast(childNode); -} AttributedString ParagraphShadowNode::getAttributedString() const { - return getTextChildNode()->getAttributedString(TextAttributes()); + return BaseTextShadowNode::getAttributedString(getProps()->getTextAttributes(), getChildren()); } void ParagraphShadowNode::setTextLayoutManager(SharedTextLayoutManager textLayoutManager) { diff --git a/ReactCommon/fabric/text/paragraph/ParagraphShadowNode.h b/ReactCommon/fabric/text/paragraph/ParagraphShadowNode.h index 2348d84655d023..df16aee1b797bd 100644 --- a/ReactCommon/fabric/text/paragraph/ParagraphShadowNode.h +++ b/ReactCommon/fabric/text/paragraph/ParagraphShadowNode.h @@ -26,14 +26,10 @@ using SharedParagraphShadowNode = std::shared_ptr; * `ShadowNode` for component, represents -like component * containing and displaying text. Text content is represented as nested * and components. - * Note some Hierarchical constraints: - * * component must have only one component. - * * component might have nested , , and -like - * components. - * * component must not have any children. */ class ParagraphShadowNode: - public ConcreteViewShadowNode { + public ConcreteViewShadowNode, + public BaseTextShadowNode { public: @@ -41,11 +37,6 @@ class ParagraphShadowNode: ComponentName getComponentName() const override; - /* - * Returns a single nested shadow node. - */ - SharedTextShadowNode getTextChildNode() const; - /* * Returns a `AttributedString` which represents text content of the node. */ diff --git a/ReactCommon/fabric/text/text/TextProps.cpp b/ReactCommon/fabric/text/text/TextProps.cpp index 402d2ea67129ca..c752a5f0ec01e0 100644 --- a/ReactCommon/fabric/text/text/TextProps.cpp +++ b/ReactCommon/fabric/text/text/TextProps.cpp @@ -18,57 +18,13 @@ namespace react { void TextProps::apply(const RawProps &rawProps) { Props::apply(rawProps); - - // Color - applyRawProp(rawProps, "color", textAttributes_.foregroundColor); - applyRawProp(rawProps, "backgroundColor", textAttributes_.backgroundColor); - applyRawProp(rawProps, "opacity", textAttributes_.opacity); - - // Font - applyRawProp(rawProps, "fontFamily", textAttributes_.fontFamily); - applyRawProp(rawProps, "fontSize", textAttributes_.fontSize); - applyRawProp(rawProps, "fontSizeMultiplier", textAttributes_.fontSizeMultiplier); - applyRawProp(rawProps, "fontWeight", textAttributes_.fontWeight); - applyRawProp(rawProps, "fontStyle", textAttributes_.fontStyle); - applyRawProp(rawProps, "fontVariant", textAttributes_.fontVariant); - applyRawProp(rawProps, "allowFontScaling", textAttributes_.allowFontScaling); - applyRawProp(rawProps, "letterSpacing", textAttributes_.letterSpacing); - - // Paragraph - applyRawProp(rawProps, "lineHeight", textAttributes_.lineHeight); - applyRawProp(rawProps, "alignment", textAttributes_.alignment); - applyRawProp(rawProps, "baseWritingDirection", textAttributes_.baseWritingDirection); - - // Decoration - applyRawProp(rawProps, "textDecorationColor", textAttributes_.textDecorationColor); - applyRawProp(rawProps, "textDecorationLineType", textAttributes_.textDecorationLineType); - applyRawProp(rawProps, "textDecorationLineStyle", textAttributes_.textDecorationLineStyle); - applyRawProp(rawProps, "textDecorationLinePattern", textAttributes_.textDecorationLinePattern); - - // Shadow - applyRawProp(rawProps, "textShadowOffset", textAttributes_.textShadowOffset); - applyRawProp(rawProps, "textShadowRadius", textAttributes_.textShadowRadius); - applyRawProp(rawProps, "textShadowColor", textAttributes_.textShadowColor); - - // Special - applyRawProp(rawProps, "isHighlighted", textAttributes_.isHighlighted); -} - -#pragma mark - Getters - -TextAttributes TextProps::getTextAttributes() const { - return textAttributes_; + BaseTextProps::apply(rawProps); } #pragma mark - DebugStringConvertible SharedDebugStringConvertibleList TextProps::getDebugProps() const { - SharedDebugStringConvertibleList list = {}; - - auto textAttributesPropsList = textAttributes_.getDebugProps(); - std::move(textAttributesPropsList.begin(), textAttributesPropsList.end(), std::back_inserter(list)); - - return list; + return BaseTextProps::getDebugProps(); } } // namespace react diff --git a/ReactCommon/fabric/text/text/TextProps.h b/ReactCommon/fabric/text/text/TextProps.h index 1a96b5519fb8b1..8762642bb02e95 100644 --- a/ReactCommon/fabric/text/text/TextProps.h +++ b/ReactCommon/fabric/text/text/TextProps.h @@ -11,6 +11,7 @@ #include #include #include +#include namespace facebook { namespace react { @@ -20,22 +21,12 @@ class TextProps; using SharedTextProps = std::shared_ptr; class TextProps: - public Props { + public Props, + public BaseTextProps { public: void apply(const RawProps &rawProps) override; -#pragma mark - Getters - - TextAttributes getTextAttributes() const; - -private: - - /* - * Not all `TextAttributes` fields make sense and is used as TextProps values. - */ - TextAttributes textAttributes_; - #pragma mark - DebugStringConvertible SharedDebugStringConvertibleList getDebugProps() const override; @@ -43,4 +34,3 @@ class TextProps: } // namespace react } // namespace facebook - diff --git a/ReactCommon/fabric/text/text/TextShadowNode.cpp b/ReactCommon/fabric/text/text/TextShadowNode.cpp index 5429c7ba606382..c49c8bfd243c18 100644 --- a/ReactCommon/fabric/text/text/TextShadowNode.cpp +++ b/ReactCommon/fabric/text/text/TextShadowNode.cpp @@ -9,9 +9,6 @@ #include -#include "RawTextShadowNode.h" -#include "RawTextProps.h" - namespace facebook { namespace react { @@ -19,41 +16,5 @@ ComponentName TextShadowNode::getComponentName() const { return ComponentName("Text"); } -AttributedString TextShadowNode::getAttributedString(const TextAttributes &baseTextAttributes) const { - // TODO: Implement caching. - - TextAttributes textAttributes = baseTextAttributes; - textAttributes.apply(getProps()->getTextAttributes()); - - AttributedString attributedString; - - for (auto &&childNode : *getChildren()) { - // RawShadowNode - SharedRawTextShadowNode rawTextShadowNode = std::dynamic_pointer_cast(childNode); - if (rawTextShadowNode) { - AttributedString::Fragment fragment; - fragment.string = rawTextShadowNode->getProps()->getText(); - fragment.textAttributes = textAttributes; - attributedString.appendFragment(fragment); - continue; - } - - // TextShadowNode - SharedTextShadowNode textShadowNode = std::dynamic_pointer_cast(childNode); - if (textShadowNode) { - attributedString.appendAttributedString(textShadowNode->getAttributedString(textAttributes)); - continue; - } - - // Any other kind of ShadowNode - AttributedString::Fragment fragment; - fragment.shadowNode = childNode; - fragment.textAttributes = textAttributes; - attributedString.appendFragment(fragment); - } - - return attributedString; -} - } // namespace react } // namespace facebook diff --git a/ReactCommon/fabric/text/text/TextShadowNode.h b/ReactCommon/fabric/text/text/TextShadowNode.h index 0eb421a96630a8..12c73e1a17e30c 100644 --- a/ReactCommon/fabric/text/text/TextShadowNode.h +++ b/ReactCommon/fabric/text/text/TextShadowNode.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -22,18 +23,14 @@ class TextShadowNode; using SharedTextShadowNode = std::shared_ptr; class TextShadowNode: - public ConcreteShadowNode { + public ConcreteShadowNode, + public BaseTextShadowNode { public: using ConcreteShadowNode::ConcreteShadowNode; ComponentName getComponentName() const override; - - /* - * Returns a `AttributedString` which represents text content of the node. - */ - AttributedString getAttributedString(const TextAttributes &baseTextAttributes) const; }; } // namespace react diff --git a/ReactCommon/fabric/textlayoutmanager/BUCK b/ReactCommon/fabric/textlayoutmanager/BUCK index c7bb2f92ec06d9..be8ed19c2885e7 100644 --- a/ReactCommon/fabric/textlayoutmanager/BUCK +++ b/ReactCommon/fabric/textlayoutmanager/BUCK @@ -1,5 +1,5 @@ -load("//configurations/buck/apple:flag_defs.bzl", "get_debug_preprocessor_flags", "get_fbobjc_enable_exception_lang_compiler_flags") -load("//ReactNative:DEFS.bzl", "IS_OSS_BUILD", "react_native_xplat_target", "rn_xplat_cxx_library", "get_apple_inspector_flags", "APPLE") +load("//configurations/buck/apple:flag_defs.bzl", "get_application_ios_flags", "get_debug_preprocessor_flags", "OBJC_ARC_PREPROCESSOR_FLAGS") +load("//ReactNative:DEFS.bzl", "IS_OSS_BUILD", "rn_xplat_cxx_library", "get_apple_inspector_flags", "react_native_xplat_target", "ANDROID", "APPLE") APPLE_COMPILER_FLAGS = [] @@ -39,14 +39,14 @@ rn_xplat_cxx_library( ":tests", ], force_static = True, - macosx_tests_override = [], frameworks = [ + "$SDKROOT/System/Library/Frameworks/CoreGraphics.framework", "$SDKROOT/System/Library/Frameworks/Foundation.framework", - "$SDKROOT/System/Library/Frameworks/QuartzCore.framework", "$SDKROOT/System/Library/Frameworks/UIKit.framework", ], - lang_compiler_flags = get_fbobjc_enable_exception_lang_compiler_flags(), - preprocessor_flags = get_debug_preprocessor_flags() + [ + macosx_tests_override = [], + platforms = (ANDROID, APPLE), + preprocessor_flags = [ "-DLOG_TAG=\"ReactNative\"", "-DWITH_FBSYSTRACE=1", ], @@ -58,6 +58,7 @@ rn_xplat_cxx_library( "xplat//folly:memory", "xplat//folly:molly", "xplat//third-party/glog:glog", + "xplat//yoga:yoga", react_native_xplat_target("fabric/attributedstring:attributedstring"), react_native_xplat_target("fabric/core:core"), react_native_xplat_target("fabric/debug:debug"), diff --git a/ReactCommon/fabric/view/BUCK b/ReactCommon/fabric/view/BUCK index 20b7108c25c753..221ea2c1055537 100644 --- a/ReactCommon/fabric/view/BUCK +++ b/ReactCommon/fabric/view/BUCK @@ -53,15 +53,15 @@ rn_xplat_cxx_library( "xplat//folly:molly", "xplat//third-party/glog:glog", "xplat//yoga:yoga", - react_native_xplat_target("fabric/debug:debug"), react_native_xplat_target("fabric/core:core"), + react_native_xplat_target("fabric/debug:debug"), react_native_xplat_target("fabric/graphics:graphics"), ], ) if not IS_OSS_BUILD: load("@xplat//build_defs:fb_xplat_cxx_test.bzl", "fb_xplat_cxx_test") - + fb_xplat_cxx_test( name = "tests", srcs = glob(["tests/**/*.cpp"]),