Skip to content

Commit

Permalink
Remove support for Android API < 23 in ReactBaseTextShadowNode
Browse files Browse the repository at this point in the history
Summary:
Since minsdk version was increased to 23, we are deleting code using Android APIs < 23 for class ReactBaseTextShadowNode

chnagelog: [Android][Breaking] Remove support for Android API < 23 in ReactBaseTextShadowNode

Differential Revision: D48545509

fbshipit-source-id: bd352443690c1b87403371bdb2936f0769d8f534
  • Loading branch information
mdvacca authored and facebook-github-bot committed Sep 26, 2023
1 parent 333fe77 commit a39c748
Showing 1 changed file with 6 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

package com.facebook.react.views.text;

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

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

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

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

protected int mNumberOfLines = UNSET;
protected int mTextAlign = Gravity.NO_GRAVITY;
protected int mTextBreakStrategy =
(Build.VERSION.SDK_INT < Build.VERSION_CODES.M) ? 0 : Layout.BREAK_STRATEGY_HIGH_QUALITY;
protected int mHyphenationFrequency =
(Build.VERSION.SDK_INT < Build.VERSION_CODES.M) ? 0 : Layout.HYPHENATION_FREQUENCY_NONE;
protected int mTextBreakStrategy = Layout.BREAK_STRATEGY_HIGH_QUALITY;
protected int mHyphenationFrequency = Layout.HYPHENATION_FREQUENCY_NONE;
protected int mJustificationMode =
(Build.VERSION.SDK_INT < Build.VERSION_CODES.O) ? 0 : Layout.JUSTIFICATION_MODE_NONE;

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

@ReactProp(name = ViewProps.TEXT_BREAK_STRATEGY)
public void setTextBreakStrategy(@Nullable String textBreakStrategy) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
return;
}

if (textBreakStrategy == null || "highQuality".equals(textBreakStrategy)) {
mTextBreakStrategy = Layout.BREAK_STRATEGY_HIGH_QUALITY;
} else if ("simple".equals(textBreakStrategy)) {
Expand Down

0 comments on commit a39c748

Please sign in to comment.