From a6c01fc6e7c2f996dccf043ff4a243ab9d865a24 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Wed, 27 Sep 2023 07:24:43 -0700 Subject: [PATCH] Remove support for Android API < 23 in ReactTextInputShadowNode Summary: Since minsdk version was increased to 23, we are deleting code using Android APIs < 23 for class ReactTextInputShadowNode chnagelog: [Android][Breaking] Remove support for Android API < 23 in ReactTextInputShadowNode Differential Revision: D48545503 fbshipit-source-id: e4c980d51faa216948302c14ed722efc2fec9339 --- .../views/textinput/ReactTextInputShadowNode.java | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputShadowNode.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputShadowNode.java index 8c123d7545b81b..878da5199174ca 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputShadowNode.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputShadowNode.java @@ -7,8 +7,6 @@ package com.facebook.react.views.textinput; -import android.annotation.TargetApi; -import android.os.Build; import android.text.Layout; import android.util.TypedValue; import android.view.ViewGroup; @@ -35,7 +33,6 @@ import com.facebook.yoga.YogaNode; @VisibleForTesting -@TargetApi(Build.VERSION_CODES.M) public class ReactTextInputShadowNode extends ReactBaseTextShadowNode implements YogaMeasureFunction { @@ -53,10 +50,7 @@ public class ReactTextInputShadowNode extends ReactBaseTextShadowNode public ReactTextInputShadowNode( @Nullable ReactTextViewManagerCallback reactTextViewManagerCallback) { super(reactTextViewManagerCallback); - mTextBreakStrategy = - (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) - ? Layout.BREAK_STRATEGY_SIMPLE - : Layout.BREAK_STRATEGY_HIGH_QUALITY; + mTextBreakStrategy = Layout.BREAK_STRATEGY_HIGH_QUALITY; initMeasureFunction(); } @@ -118,8 +112,7 @@ public long measure( editText.setLines(mNumberOfLines); } - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M - && editText.getBreakStrategy() != mTextBreakStrategy) { + if (editText.getBreakStrategy() != mTextBreakStrategy) { editText.setBreakStrategy(mTextBreakStrategy); } } @@ -182,10 +175,6 @@ public void setPlaceholder(@Nullable String placeholder) { @Override public void setTextBreakStrategy(@Nullable String textBreakStrategy) { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { - return; - } - if (textBreakStrategy == null || "simple".equals(textBreakStrategy)) { mTextBreakStrategy = Layout.BREAK_STRATEGY_SIMPLE; } else if ("highQuality".equals(textBreakStrategy)) {