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
This commit is contained in:
Ahmed El-Helw 2016-02-25 16:26:29 -08:00 committed by facebook-github-bot-7
parent d9c0f24116
commit 652c1c11e4
1 changed files with 2 additions and 7 deletions

View File

@ -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();
}