diff --git a/ReactCommon/react/renderer/attributedstring/TextAttributes.cpp b/ReactCommon/react/renderer/attributedstring/TextAttributes.cpp index 741dcc85d4647f..90fc6513cd226d 100644 --- a/ReactCommon/react/renderer/attributedstring/TextAttributes.cpp +++ b/ReactCommon/react/renderer/attributedstring/TextAttributes.cpp @@ -98,7 +98,7 @@ void TextAttributes::apply(TextAttributes textAttributes) { accessibilityRole = textAttributes.accessibilityRole.has_value() ? textAttributes.accessibilityRole : accessibilityRole; - accessibilityUnit = !textAttributes.accessibilityUnit.empty() ? textAttributes.accessibilityUnit + accessibilityUnit = !textAttributes.accessibilityUnit.has_value() ? textAttributes.accessibilityUnit : accessibilityUnit; } diff --git a/ReactCommon/react/renderer/attributedstring/TextAttributes.h b/ReactCommon/react/renderer/attributedstring/TextAttributes.h index 017e2d38e16ba9..4bf42586f5a173 100644 --- a/ReactCommon/react/renderer/attributedstring/TextAttributes.h +++ b/ReactCommon/react/renderer/attributedstring/TextAttributes.h @@ -79,7 +79,7 @@ class TextAttributes : public DebugStringConvertible { // construction. std::optional layoutDirection{}; std::optional accessibilityRole{}; - std::string accessibilityUnit{}; + AccessibilityUnit accessibilityUnit{}; #pragma mark - Operations diff --git a/ReactCommon/react/renderer/attributedstring/primitives.h b/ReactCommon/react/renderer/attributedstring/primitives.h index 39e8f31e18b4a6..69c7caffc4000e 100644 --- a/ReactCommon/react/renderer/attributedstring/primitives.h +++ b/ReactCommon/react/renderer/attributedstring/primitives.h @@ -135,6 +135,10 @@ enum class AccessibilityRole { Toolbar, }; +struct AccessibilityUnit { + std::string hours{""}; +}; + enum class TextTransform { None, Uppercase,