diff --git a/ReactCommon/react/renderer/components/text/ParagraphShadowNode.cpp b/ReactCommon/react/renderer/components/text/ParagraphShadowNode.cpp index 993cc65b883..b4fc65923a6 100644 --- a/ReactCommon/react/renderer/components/text/ParagraphShadowNode.cpp +++ b/ReactCommon/react/renderer/components/text/ParagraphShadowNode.cpp @@ -164,6 +164,18 @@ void ParagraphShadowNode::layout(LayoutContext layoutContext) { updateStateIfNeeded(content); + if (content.attachments.empty()) { +#ifndef ANDROID + if (getConcreteProps().onTextLayout) { + // `onTextLayout` needs to be called even if text is empty + // to be compatible with Paper. + getConcreteEventEmitter().onTextLayout({}); + } +#endif + // No attachments, nothing to layout. + return; + } + auto measurement = textLayoutManager_->measure( AttributedStringBox{content.attributedString}, content.paragraphAttributes, @@ -179,11 +191,6 @@ void ParagraphShadowNode::layout(LayoutContext layoutContext) { } #endif - if (content.attachments.empty()) { - // No attachments, nothing to layout. - return; - } - // Iterating on attachments, we clone shadow nodes and moving // `paragraphShadowNode` that represents clones of `this` object. auto paragraphShadowNode = static_cast(this);