From 652c1c11e4c81f2e42c1fdd82f4d433bf822b89e Mon Sep 17 00:00:00 2001 From: Ahmed El-Helw Date: Thu, 25 Feb 2016 16:26:29 -0800 Subject: [PATCH] Fix incorrect MeasureSpec in ReactTextInputShadowNode Summary:WRAP_CONTENT is not a valid size for MeasureSpec. While 0 is a valid value size to pass to makeMeasureSpec, it's slightly cheaper to just pass in 0 instead since makeMeasureSpec(0, UNSPECIFIED) is 0 anyway. Differential Revision: D2968322 fb-gh-sync-id: 2ca0e27b12c1a8263800d96fec32127a4b967497 shipit-source-id: 2ca0e27b12c1a8263800d96fec32127a4b967497 --- .../react/views/textinput/ReactTextInputShadowNode.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputShadowNode.java b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputShadowNode.java index 6172770dd..69bb72774 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputShadowNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputShadowNode.java @@ -13,7 +13,6 @@ import javax.annotation.Nullable; import android.text.Spannable; import android.util.TypedValue; -import android.view.View; import android.view.ViewGroup; import android.widget.EditText; @@ -23,10 +22,10 @@ import com.facebook.csslayout.Spacing; import com.facebook.infer.annotation.Assertions; import com.facebook.react.common.annotations.VisibleForTesting; import com.facebook.react.uimanager.PixelUtil; -import com.facebook.react.uimanager.annotations.ReactProp; import com.facebook.react.uimanager.ThemedReactContext; import com.facebook.react.uimanager.UIViewOperationQueue; import com.facebook.react.uimanager.ViewDefaults; +import com.facebook.react.uimanager.annotations.ReactProp; import com.facebook.react.views.text.ReactTextShadowNode; import com.facebook.react.views.text.ReactTextUpdate; @@ -34,10 +33,6 @@ import com.facebook.react.views.text.ReactTextUpdate; public class ReactTextInputShadowNode extends ReactTextShadowNode implements CSSNode.MeasureFunction { - private static final int MEASURE_SPEC = View.MeasureSpec.makeMeasureSpec( - ViewGroup.LayoutParams.WRAP_CONTENT, - View.MeasureSpec.UNSPECIFIED); - private @Nullable EditText mEditText; private @Nullable float[] mComputedPadding; private int mJsEventCount = UNSET; @@ -88,7 +83,7 @@ public class ReactTextInputShadowNode extends ReactTextShadowNode implements editText.setLines(mNumberOfLines); } - editText.measure(MEASURE_SPEC, MEASURE_SPEC); + editText.measure(0 /* unspecified */, 0 /* unspecified */); measureOutput.height = editText.getMeasuredHeight(); }