Merge textDecoration(LineStyle|LinePattern) into textDecorationStyle

Summary:
The [first implementation of `TextAttributes` in Fabric](https://github.com/facebook/react-native/commit/62576bcb7832e08c6fd9f9482285882c37a2ece5) included two separate props instead of `textDecorationStyle`: `textDecorationLineStyle` (single, double, ...) and `textDecorationLinePattern` (dot, dash, dotdash, ...). These two props were implemented in C++ and iOS but never supported in JS.

Pre-Fabric (and CSS) on the other hand use a single prop `textDecorationStyle: 'solid' | 'double' | 'dotted' | 'dashed'`.

This diff implements this same API in Fabric, and removes the unused `textDecorationLineStyle` and `textDecorationLinePattern` props.

Changelog:
[iOS][Fixed] - Implement `textDecorationStyle` on iOS and remove unused `textDecorationLineStyle` and `textDecorationLinePattern` from Fabric.

Reviewed By: dmitryrykun

Differential Revision: D31617598

fbshipit-source-id: f5173e7ecdd31aafa0e5f0e50137eefa0505e007
This commit is contained in:
Rob Hogan
2021-10-18 02:16:03 -07:00
committed by Facebook GitHub Bot
parent f1b5fe1d3e
commit 61755aced1
8 changed files with 58 additions and 179 deletions
@@ -71,13 +71,9 @@ void TextAttributes::apply(TextAttributes textAttributes) {
textDecorationLineType = textAttributes.textDecorationLineType.hasValue()
? textAttributes.textDecorationLineType
: textDecorationLineType;
textDecorationLineStyle = textAttributes.textDecorationLineStyle.hasValue()
? textAttributes.textDecorationLineStyle
: textDecorationLineStyle;
textDecorationLinePattern =
textAttributes.textDecorationLinePattern.hasValue()
? textAttributes.textDecorationLinePattern
: textDecorationLinePattern;
textDecorationStyle = textAttributes.textDecorationStyle.hasValue()
? textAttributes.textDecorationStyle
: textDecorationStyle;
// Shadow
textShadowOffset = textAttributes.textShadowOffset.hasValue()
@@ -117,8 +113,7 @@ bool TextAttributes::operator==(const TextAttributes &rhs) const {
baseWritingDirection,
textDecorationColor,
textDecorationLineType,
textDecorationLineStyle,
textDecorationLinePattern,
textDecorationStyle,
textShadowOffset,
textShadowColor,
isHighlighted,
@@ -137,8 +132,7 @@ bool TextAttributes::operator==(const TextAttributes &rhs) const {
rhs.baseWritingDirection,
rhs.textDecorationColor,
rhs.textDecorationLineType,
rhs.textDecorationLineStyle,
rhs.textDecorationLinePattern,
rhs.textDecorationStyle,
rhs.textShadowOffset,
rhs.textShadowColor,
rhs.isHighlighted,
@@ -199,10 +193,7 @@ SharedDebugStringConvertibleList TextAttributes::getDebugProps() const {
debugStringConvertibleItem("textDecorationColor", textDecorationColor),
debugStringConvertibleItem(
"textDecorationLineType", textDecorationLineType),
debugStringConvertibleItem(
"textDecorationLineStyle", textDecorationLineStyle),
debugStringConvertibleItem(
"textDecorationLinePattern", textDecorationLinePattern),
debugStringConvertibleItem("textDecorationStyle", textDecorationStyle),
// Shadow
debugStringConvertibleItem("textShadowOffset", textShadowOffset),