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 c7c8025ef..6564f284a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/flat/RCTText.java +++ b/ReactAndroid/src/main/java/com/facebook/react/flat/RCTText.java @@ -18,6 +18,7 @@ import android.text.StaticLayout; import android.text.TextPaint; import android.text.TextUtils; +import com.facebook.csslayout.CSSMeasureMode; import com.facebook.csslayout.CSSNode; import com.facebook.csslayout.MeasureOutput; import com.facebook.csslayout.Spacing; @@ -67,7 +68,13 @@ import com.facebook.react.uimanager.annotations.ReactProp; } @Override - public void measure(CSSNode node, float width, float height, MeasureOutput measureOutput) { + public void measure( + CSSNode node, + float width, + CSSMeasureMode widthMode, + float height, + CSSMeasureMode heightMode, + MeasureOutput measureOutput) { CharSequence text = getText(); if (TextUtils.isEmpty(text)) { // to indicate that we don't have anything to display @@ -80,8 +87,7 @@ import com.facebook.react.uimanager.annotations.ReactProp; mText = text; // technically, width should never be negative, but there is currently a bug in - // LayoutEngine where a negative value can be passed. - boolean unconstrainedWidth = Float.isNaN(width) || width < 0; + boolean unconstrainedWidth = widthMode == CSSMeasureMode.UNDEFINED || width < 0; BoringLayout.Metrics metrics = BoringLayout.isBoring(text, PAINT, sBoringLayoutMetrics); if (metrics != null) { 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 076d4d61c..375329ac1 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/flat/RCTTextInput.java +++ b/ReactAndroid/src/main/java/com/facebook/react/flat/RCTTextInput.java @@ -16,6 +16,7 @@ import android.util.TypedValue; import android.view.ViewGroup; import android.widget.EditText; +import com.facebook.csslayout.CSSMeasureMode; import com.facebook.csslayout.CSSNode; import com.facebook.csslayout.MeasureOutput; import com.facebook.csslayout.Spacing; @@ -70,7 +71,13 @@ public class RCTTextInput extends RCTVirtualText implements AndroidView, CSSNode } @Override - public void measure(CSSNode node, float width, float height, MeasureOutput measureOutput) { + public void measure( + CSSNode node, + float width, + CSSMeasureMode widthMode, + float height, + CSSMeasureMode heightMode, + MeasureOutput measureOutput) { // measure() should never be called before setThemedContext() EditText editText = Assertions.assertNotNull(mEditText);