mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Support TextDecorationLine in Nodes
Summary: Nodes wasn't supporting text decorations to the line (strike through and underline). This patch implements that. Differential Revision: D3512711
This commit is contained in:
@@ -172,6 +172,29 @@ import com.facebook.react.uimanager.annotations.ReactProp;
|
||||
}
|
||||
}
|
||||
|
||||
@ReactProp(name = ViewProps.TEXT_DECORATION_LINE)
|
||||
public void setTextDecorationLine(@Nullable String textDecorationLineString) {
|
||||
boolean isUnderlineTextDecorationSet = false;
|
||||
boolean isLineThroughTextDecorationSet = false;
|
||||
if (textDecorationLineString != null) {
|
||||
for (String textDecorationLineSubString : textDecorationLineString.split(" ")) {
|
||||
if ("underline".equals(textDecorationLineSubString)) {
|
||||
isUnderlineTextDecorationSet = true;
|
||||
} else if ("line-through".equals(textDecorationLineSubString)) {
|
||||
isLineThroughTextDecorationSet = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isUnderlineTextDecorationSet != mFontStylingSpan.hasUnderline() ||
|
||||
isLineThroughTextDecorationSet != mFontStylingSpan.hasStrikeThrough()) {
|
||||
FontStylingSpan span = getSpan();
|
||||
span.setHasUnderline(isUnderlineTextDecorationSet);
|
||||
span.setHasStrikeThrough(isLineThroughTextDecorationSet);
|
||||
notifyChanged(true);
|
||||
}
|
||||
}
|
||||
|
||||
@ReactProp(name = ViewProps.FONT_STYLE)
|
||||
public void setFontStyle(@Nullable String fontStyleString) {
|
||||
final int fontStyle;
|
||||
|
||||
Reference in New Issue
Block a user