diff --git a/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputShadowNode.cpp b/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputShadowNode.cpp index fde3732774b..617e19c06f6 100644 --- a/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputShadowNode.cpp +++ b/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputShadowNode.cpp @@ -30,7 +30,8 @@ void AndroidTextInputShadowNode::setContextContainer( contextContainer_ = contextContainer; } -AttributedString AndroidTextInputShadowNode::getAttributedString() const { +AttributedString AndroidTextInputShadowNode::getAttributedString( + bool usePlaceholders) const { auto textAttributes = TextAttributes::defaultTextAttributes(); textAttributes.apply(getProps()->textAttributes); @@ -38,7 +39,7 @@ AttributedString AndroidTextInputShadowNode::getAttributedString() const { { auto const &attributedString = BaseTextShadowNode::getAttributedString(textAttributes, *this); - if (!attributedString.isEmpty()) { + if (!attributedString.isEmpty() || !usePlaceholders) { return attributedString; } } @@ -69,7 +70,7 @@ void AndroidTextInputShadowNode::setTextLayoutManager( void AndroidTextInputShadowNode::updateStateIfNeeded() { ensureUnsealed(); - auto attributedString = getAttributedString(); + auto attributedString = getAttributedString(false); auto const &state = getStateData(); assert(textLayoutManager_); @@ -92,7 +93,7 @@ void AndroidTextInputShadowNode::updateStateIfNeeded() { Size AndroidTextInputShadowNode::measure( LayoutConstraints layoutConstraints) const { - AttributedString attributedString = getAttributedString(); + AttributedString attributedString = getAttributedString(true); if (attributedString.isEmpty()) { return {0, 0}; diff --git a/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputShadowNode.h b/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputShadowNode.h index 0576be16ca6..796260c8c85 100644 --- a/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputShadowNode.h +++ b/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputShadowNode.h @@ -37,7 +37,7 @@ class AndroidTextInputShadowNode : public ConcreteViewShadowNode< /* * Returns a `AttributedString` which represents text content of the node. */ - AttributedString getAttributedString() const; + AttributedString getAttributedString(bool usePlaceholders) const; /* * Associates a shared TextLayoutManager with the node.