From 0f726ddec0c548704353d18dce26e46c96c5a0ba Mon Sep 17 00:00:00 2001 From: Qichen Zhu <57348009+QichenZhu@users.noreply.github.com> Date: Tue, 14 Apr 2026 13:26:21 +1200 Subject: [PATCH] Fix accessibilityState={{expanded: false}} ignored on iOS --- .../ComponentViews/View/RCTViewComponentView.mm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm b/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm index 8aeb2f76c2b6..386bfe750217 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm @@ -1525,11 +1525,15 @@ - (NSString *)accessibilityValue addObject:RCTLocalizedString( "mixed", "a checkbox, radio button, or other widget which is both checked and unchecked")]; } - if (accessibilityState.expanded.value_or(false)) { - [valueComponents - addObject:RCTLocalizedString("expanded", "a menu, dialog, accordian panel, or other widget which is expanded")]; + if (accessibilityState.expanded.has_value()) { + if (accessibilityState.expanded.value()) { + [valueComponents + addObject:RCTLocalizedString("expanded", "a menu, dialog, accordian panel, or other widget which is expanded")]; + } else { + [valueComponents + addObject:RCTLocalizedString("collapsed", "a menu, dialog, accordian panel, or other widget which is collapsed")]; + } } - if (accessibilityState.busy) { [valueComponents addObject:RCTLocalizedString("busy", "an element currently being updated or modified")]; }