Skip to content

Commit

Permalink
round up layoutWidth for Android 11 in ReactTextShadowNode
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Michael Yoon (LAX) authored and facebook-github-bot committed Sep 26, 2020
1 parent 920bd2c commit 1438543
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ public long measure(
}
}

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);
Expand Down

0 comments on commit 1438543

Please sign in to comment.