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:
Ahmed El-Helw
2016-07-11 13:31:51 -07:00
parent e674185ea1
commit b300c1979c
2 changed files with 51 additions and 0 deletions
@@ -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;