Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,20 @@ class BaseTextInputShadowNode
layoutContext.fontSizeMultiplier;
if (meaningfulState) {
const auto &stateData = BaseShadowNode::getStateData();

// State is synced with the React tree in `layout()`, after measurement. When
// `text` is empty and the children changed, `attributedStringBox` still holds
// the previous text, so measure the React tree instead.
if (BaseShadowNode::getConcreteProps().text.empty()) {
auto attributedString = getAttributedString(layoutContext);
if (!stateData.reactTreeAttributedString.isContentEqual(attributedString)) {
if (attributedString.isEmpty()) {
attributedString = getPlaceholderAttributedString(layoutContext);
}
return AttributedStringBox{attributedString};
}
}

auto attributedStringBox = stateData.attributedStringBox;
if (attributedStringBox.getMode() == AttributedStringBox::Mode::OpaquePointer ||
!attributedStringBox.getValue().isEmpty()) {
Expand Down
Loading