From 9498f22439fb1b822811822146749e490d780f3f Mon Sep 17 00:00:00 2001 From: Ahmed El-Helw Date: Thu, 3 Mar 2016 13:44:17 -0800 Subject: [PATCH] Use layout width for BoringLayout in Nodes Summary: In D2980358, alignment was implemented for nodes. This unfortunately introduced a bug, which is that when we have a BoringLayout that is set to ALIGN_CENTER, it can't be seen. This is a result of the fact that the width passed in to BoringLayout is Integer.MAX_VALUE. Since measure has already been called at this point, we can just pass the layout's width as the width of the BoringLayout. Reviewed By: sriramramani Differential Revision: D3004971 --- ReactAndroid/src/main/java/com/facebook/react/flat/RCTText.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/flat/RCTText.java b/ReactAndroid/src/main/java/com/facebook/react/flat/RCTText.java index 223d4b8d288..e4f0a547f7a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/flat/RCTText.java +++ b/ReactAndroid/src/main/java/com/facebook/react/flat/RCTText.java @@ -173,7 +173,7 @@ import com.facebook.react.uimanager.annotations.ReactProp; mDrawCommand = new DrawTextLayout(new BoringLayout( mText, PAINT, - Integer.MAX_VALUE, // fits one line so don't care about the width + (int) getLayoutWidth(), mAlignment, mSpacingMult, mSpacingAdd,