From 1438543a2fe274b6c21fc744e8ddeabd2261bdbf Mon Sep 17 00:00:00 2001 From: "Michael Yoon (LAX)" Date: Fri, 25 Sep 2020 19:04:29 -0700 Subject: [PATCH] round up layoutWidth for Android 11 in ReactTextShadowNode Summary: in Android 11, there's an issue where Text content is being clipped. The root cause appears to be a breaking change in how Android 11 is measuring text. rounding up the layoutWidth calculation mitigates the issue. Changelog: [Internal] Reviewed By: JoshuaGross Differential Revision: D23944772 fbshipit-source-id: 1639259da1c2c507c6bfc80fed377577316febac --- .../com/facebook/react/views/text/ReactTextShadowNode.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.java index ac84caae1e0..5dbd0796e53 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.java @@ -144,6 +144,9 @@ public class ReactTextShadowNode extends ReactBaseTextShadowNode { } } + if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.Q) { + layoutWidth = (float) Math.ceil(layoutWidth); + } float layoutHeight = height; if (heightMode != YogaMeasureMode.EXACTLY) { layoutHeight = layout.getLineBottom(lineCount - 1);