Fix parsing of textAlign props in C++

Summary:
This diff fixes the parsing of the textAlign prop in Fabric. The current parsing does not support 'justify' or 'auto' values.
See https://facebook.github.io/react-native/docs/0.59/text-style-props#textalign for more details about the values of these props in the JS side.

Reviewed By: shergin

Differential Revision: D16269509

fbshipit-source-id: e0d9168d6022245430de644f7c4e45c968b1326b
This commit is contained in:
David Vacca
2019-07-15 18:33:26 -07:00
committed by Facebook Github Bot
parent c38d6f26e0
commit bcc482e655
@@ -198,7 +198,7 @@ inline std::string toString(const FontVariant &fontVariant) {
inline void fromRawValue(const RawValue &value, TextAlignment &result) {
auto string = (std::string)value;
if (string == "natural") {
if (string == "auto") {
result = TextAlignment::Natural;
return;
}
@@ -214,7 +214,7 @@ inline void fromRawValue(const RawValue &value, TextAlignment &result) {
result = TextAlignment::Right;
return;
}
if (string == "justified") {
if (string == "justify") {
result = TextAlignment::Justified;
return;
}
@@ -276,13 +276,13 @@ inline void fromRawValue(
result = TextDecorationLineType::Underline;
return;
}
// TODO: remove "line-through" after deprecation
if (string == "strikethrough" || string == "line-through") {
result = TextDecorationLineType::Strikethrough;
return;
}
// TODO: remove "underline line-through" after "line-through" deprecation
if (string == "underline-strikethrough" || string == "underline line-through") {
result = TextDecorationLineType::UnderlineStrikethrough;