From 3ac0bd632cc19f0f42bd70624122a7fe5347d4d2 Mon Sep 17 00:00:00 2001 From: Andrei Coman Date: Mon, 12 Sep 2016 05:03:27 -0700 Subject: [PATCH] Fix Text incorrect line height Summary: @public Setting the line height with the help of Android-provided StaticLayout is incorrect. A simple example app will display the following when `setLineSpacing(50.f, 0.f)` is set: {F62987699}. You'll notice that the height of the first line is a few pixels shorter than the other lines. So we use a custom LineHeightSpan instead, which needs to be applied to the text itself, and no height-related attributes need to be set on the TextView itself. Reviewed By: lexs Differential Revision: D3841658 --- .../src/main/java/com/facebook/react/flat/RCTTextInput.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/flat/RCTTextInput.java b/ReactAndroid/src/main/java/com/facebook/react/flat/RCTTextInput.java index 63582ca8594..601bd2d0be0 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/flat/RCTTextInput.java +++ b/ReactAndroid/src/main/java/com/facebook/react/flat/RCTTextInput.java @@ -128,7 +128,7 @@ public class RCTTextInput extends RCTVirtualText implements AndroidView, CSSNode super.onCollectExtraUpdates(uiViewOperationQueue); if (mJsEventCount != UNSET) { ReactTextUpdate reactTextUpdate = - new ReactTextUpdate(getText(), mJsEventCount, false, getPadding(), Float.NaN, UNSET); + new ReactTextUpdate(getText(), mJsEventCount, false, getPadding(), UNSET); // TODO: the Float.NaN should be replaced with the real line height see D3592781 uiViewOperationQueue.enqueueUpdateExtraData(getReactTag(), reactTextUpdate); }