Skip to content

Commit 7c93863

Browse files
committed
this is a workaround for Fam issue facebook#172 where text would be cut off on some TextView's.
It seems that the height reported via Layout and height expected based on lineHeight differ for single line text. This was the best workaround I could come up with after working on it for a day.
1 parent f7ef5d0 commit 7c93863

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ public void measure(CSSNode node, float width, float height, MeasureOutput measu
269269
? Math.min(reactCSSNode.mNumberOfLines, layout.getLineCount())
270270
: layout.getLineCount();
271271
float lineHeight = PixelUtil.toPixelFromSP(reactCSSNode.mLineHeight);
272-
measureOutput.height = lineHeight * lines;
272+
measureOutput.height = layout.getLineCount() == 1 ? layout.getHeight() : lineHeight * lines;
273273
}
274274
}
275275
};

0 commit comments

Comments
 (0)