Skip to content

Commit 0505f5c

Browse files
mdvaccafacebook-github-bot
authored andcommitted
Remove support for Android API < 23 in ReactBaseTextShadowNode (#39665)
Summary: Pull Request resolved: #39665 Since minsdk version was increased to 23, we are deleting code using Android APIs < 23 for class ReactBaseTextShadowNode changelog: [Android][Breaking] Remove support for Android API < 23 in ReactBaseTextShadowNode Reviewed By: NickGerleman Differential Revision: D48545509 fbshipit-source-id: 2bd1c74251c8af92013b065daafbab3d96a05a2e
1 parent 0b1fcfb commit 0505f5c

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
package com.facebook.react.views.text;
99

10-
import android.annotation.TargetApi;
1110
import android.graphics.Color;
1211
import android.graphics.Typeface;
1312
import android.os.Build;
@@ -50,7 +49,6 @@
5049
* <p>This also node calculates {@link Spannable} object based on subnodes of the same type, which
5150
* can be used in concrete classes to feed native views and compute layout.
5251
*/
53-
@TargetApi(Build.VERSION_CODES.M)
5452
public abstract class ReactBaseTextShadowNode extends LayoutShadowNode {
5553

5654
// Use a direction weak character so the placeholder doesn't change the direction of the previous
@@ -75,9 +73,9 @@ private static void buildSpannedFromShadowNode(
7573
ReactBaseTextShadowNode textShadowNode,
7674
SpannableStringBuilder sb,
7775
List<SetSpanOperation> ops,
78-
TextAttributes parentTextAttributes,
76+
@Nullable TextAttributes parentTextAttributes,
7977
boolean supportsInlineViews,
80-
Map<Integer, ReactShadowNode> inlineViews,
78+
@Nullable Map<Integer, ReactShadowNode> inlineViews,
8179
int start) {
8280

8381
TextAttributes textAttributes;
@@ -226,7 +224,7 @@ private static void buildSpannedFromShadowNode(
226224
// `nativeViewHierarchyOptimizer` can be `null` as long as `supportsInlineViews` is `false`.
227225
protected Spannable spannedFromShadowNode(
228226
ReactBaseTextShadowNode textShadowNode,
229-
String text,
227+
@Nullable String text,
230228
boolean supportsInlineViews,
231229
NativeViewHierarchyOptimizer nativeViewHierarchyOptimizer) {
232230
Assertions.assertCondition(
@@ -240,8 +238,7 @@ protected Spannable spannedFromShadowNode(
240238
// up-to-bottom, otherwise all the spannables that are within the region for which one may set
241239
// a new spannable will be wiped out
242240
List<SetSpanOperation> ops = new ArrayList<>();
243-
Map<Integer, ReactShadowNode> inlineViews =
244-
supportsInlineViews ? new HashMap<Integer, ReactShadowNode>() : null;
241+
Map<Integer, ReactShadowNode> inlineViews = supportsInlineViews ? new HashMap<>() : null;
245242

246243
if (text != null) {
247244
// Handle text that is provided via a prop (e.g. the `value` and `defaultValue` props on
@@ -312,10 +309,8 @@ protected Spannable spannedFromShadowNode(
312309

313310
protected int mNumberOfLines = UNSET;
314311
protected int mTextAlign = Gravity.NO_GRAVITY;
315-
protected int mTextBreakStrategy =
316-
(Build.VERSION.SDK_INT < Build.VERSION_CODES.M) ? 0 : Layout.BREAK_STRATEGY_HIGH_QUALITY;
317-
protected int mHyphenationFrequency =
318-
(Build.VERSION.SDK_INT < Build.VERSION_CODES.M) ? 0 : Layout.HYPHENATION_FREQUENCY_NONE;
312+
protected int mTextBreakStrategy = Layout.BREAK_STRATEGY_HIGH_QUALITY;
313+
protected int mHyphenationFrequency = Layout.HYPHENATION_FREQUENCY_NONE;
319314
protected int mJustificationMode =
320315
(Build.VERSION.SDK_INT < Build.VERSION_CODES.O) ? 0 : Layout.JUSTIFICATION_MODE_NONE;
321316

@@ -554,10 +549,6 @@ public void setTextDecorationLine(@Nullable String textDecorationLineString) {
554549

555550
@ReactProp(name = ViewProps.TEXT_BREAK_STRATEGY)
556551
public void setTextBreakStrategy(@Nullable String textBreakStrategy) {
557-
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
558-
return;
559-
}
560-
561552
if (textBreakStrategy == null || "highQuality".equals(textBreakStrategy)) {
562553
mTextBreakStrategy = Layout.BREAK_STRATEGY_HIGH_QUALITY;
563554
} else if ("simple".equals(textBreakStrategy)) {

0 commit comments

Comments
 (0)