Skip to content

Commit

Permalink
move accessibilityLabel to TextStyle
Browse files Browse the repository at this point in the history
Summary: as per title

Differential Revision: D47550982

fbshipit-source-id: 9e1c561777ea954927fbe8100d71906129abcb64
  • Loading branch information
Pasquale Anatriello authored and facebook-github-bot committed Jul 24, 2023
1 parent d1e16f4 commit ee3c1b3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ public void mount(TextLayout textLayout) {
}
}
mClickableSpans = textLayout.clickableSpans;
if (textLayout.textStyle.accessibilityLabel != null) {
setContentDescription(textLayout.textStyle.accessibilityLabel);
}
invalidate();
}

Expand All @@ -186,6 +189,8 @@ public void unmount() {
mImageSpans = null;
}
mClickableSpans = null;
setContentDescription("");

if (mRCTextAccessibilityDelegate != null) {
mRCTextAccessibilityDelegate.invalidateRoot();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import android.util.SparseIntArray;
import android.view.View;
import androidx.annotation.GuardedBy;
import androidx.annotation.Nullable;
import androidx.annotation.Size;
import androidx.annotation.VisibleForTesting;
import androidx.core.text.TextDirectionHeuristicsCompat;
Expand Down Expand Up @@ -69,7 +68,6 @@ void onTextMeasured(
public static class TextLayout {
public Layout layout;
public CharSequence processedText;
@Nullable public String accessibilityLabel;
public float textLayoutTranslationX;
public float textLayoutTranslationY;
ClickableSpan[] clickableSpans;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,12 @@ public class TextStyle implements Cloneable {
int manualCapSpacing = Integer.MIN_VALUE;
float extraSpacingLeft = 0;
float extraSpacingRight = 0;

RoundedBackgroundProps roundedBackgroundProps = null;
@Nullable String accessibilityLabel;

public void setAccessibilityLabel(String accessibilityLabel) {
this.accessibilityLabel = accessibilityLabel;
}

public void setShouldLayoutEmptyText(boolean shouldLayoutEmptyText) {
this.shouldLayoutEmptyText = shouldLayoutEmptyText;
Expand Down

0 comments on commit ee3c1b3

Please sign in to comment.