Extend Text to support measurement of empty Texts

Summary:
This diff extends the measurement of Text components in order to support empty strings.
This is required for parity with Paper.
I created a follow up task to analyze support of empty string as part of the Text infrastructure of Fabric in the future.

changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D21761171

fbshipit-source-id: d2aa074052b09732af5d35723f19014090fcabbf
This commit is contained in:
David Vacca
2020-05-28 15:07:49 -07:00
committed by Facebook GitHub Bot
parent 34b23c1220
commit 4b596fd5b3
5 changed files with 28 additions and 6 deletions
@@ -62,6 +62,8 @@ AttributedString AndroidTextInputShadowNode::getAttributedString() const {
// single character in the string so that the measured height is greater
// than zero. Otherwise, empty TextInputs with no placeholder don't
// display at all.
// TODO T67606511: We will redefine the measurement of empty strings as part
// of T67606511
AttributedString AndroidTextInputShadowNode::getPlaceholderAttributedString()
const {
// Return placeholder text, since text and children are empty.
@@ -70,7 +72,7 @@ AttributedString AndroidTextInputShadowNode::getPlaceholderAttributedString()
fragment.string = getConcreteProps().placeholder;
if (fragment.string.empty()) {
fragment.string = " ";
fragment.string = BaseTextShadowNode::getEmptyPlaceholder();
}
auto textAttributes = TextAttributes::defaultTextAttributes();