From c3b37b0492456f9556166bec109a5426d3ae768e Mon Sep 17 00:00:00 2001 From: Tyler Williams Date: Thu, 27 Aug 2026 09:57:47 -0400 Subject: [PATCH] fix: stale VoiceOver value from async UI updates to Text --- .../ComponentViews/Text/RCTParagraphComponentView.mm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm b/packages/react-native/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm index 500c0815f58c..228ec0d2a28f 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm @@ -138,6 +138,17 @@ - (void)updateState:(const State::Shared &)state oldState:(const State::Shared & _textView.state = std::static_pointer_cast(state); [_textView setNeedsDisplay]; [self setNeedsLayout]; + + // If the attributed string has changed, we need to notify the accessibility system that something changed, + // otherwise it may hold on to stale values (this happens most often when an element is updated async) + // https://github.com/react/react-native/issues/58145 + if (state && oldState) { + const auto &newData = std::static_pointer_cast(state)->getData(); + const auto &oldData = std::static_pointer_cast(oldState)->getData(); + if (!newData.attributedString.isContentEqual(oldData.attributedString)) { + UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, nil); + } + } } - (void)updateLayoutMetrics:(const LayoutMetrics &)layoutMetrics