Fabric: Introducing BaseTextShadowNode::getAttributedString()

Summary:
`BaseTextShadowNode::getAttributedString()` was replaced with simular method `BaseTextShadowNode::buildAttributedString()` which does same work with following differences:
* Besides returning `AttributedString`, it retures an array of `Attachment`s elements of which points to `ShadowNode`s that form attachments;
* Now we use single `AttributedString` to construct result instead of concatenation objects recurvily walking the tree.

We will use the array of attachments later.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D20268048

fbshipit-source-id: 371c548826bdfd5c4f4b18915d68977724885ce6
This commit is contained in:
Valentin Shergin
2020-03-09 16:32:33 -07:00
committed by Facebook Github Bot
parent dedf9372ca
commit f18358dda6
5 changed files with 66 additions and 28 deletions
@@ -33,8 +33,11 @@ AttributedString AndroidTextInputShadowNode::getAttributedString() const {
// Use BaseTextShadowNode to get attributed string from children
auto childTextAttributes = TextAttributes::defaultTextAttributes();
childTextAttributes.apply(getConcreteProps().textAttributes);
auto attributedString =
BaseTextShadowNode::getAttributedString(childTextAttributes, *this);
auto attributedString = AttributedString{};
auto attachments = BaseTextShadowNode::Attachments{};
BaseTextShadowNode::buildAttributedString(
childTextAttributes, *this, attributedString, attachments);
// BaseTextShadowNode only gets children. We must detect and prepend text
// value attributes manually.