Skip to content

Commit 0f726dd

Browse files
committed
Fix accessibilityState={{expanded: false}} ignored on iOS
1 parent 179e0cd commit 0f726dd

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1525,11 +1525,15 @@ - (NSString *)accessibilityValue
15251525
addObject:RCTLocalizedString(
15261526
"mixed", "a checkbox, radio button, or other widget which is both checked and unchecked")];
15271527
}
1528-
if (accessibilityState.expanded.value_or(false)) {
1529-
[valueComponents
1530-
addObject:RCTLocalizedString("expanded", "a menu, dialog, accordian panel, or other widget which is expanded")];
1528+
if (accessibilityState.expanded.has_value()) {
1529+
if (accessibilityState.expanded.value()) {
1530+
[valueComponents
1531+
addObject:RCTLocalizedString("expanded", "a menu, dialog, accordian panel, or other widget which is expanded")];
1532+
} else {
1533+
[valueComponents
1534+
addObject:RCTLocalizedString("collapsed", "a menu, dialog, accordian panel, or other widget which is collapsed")];
1535+
}
15311536
}
1532-
15331537
if (accessibilityState.busy) {
15341538
[valueComponents addObject:RCTLocalizedString("busy", "an element currently being updated or modified")];
15351539
}

0 commit comments

Comments
 (0)