Skip to content

Commit bccbca0

Browse files
authored
refactor!(iOS): move changesSelectionAsPrimaryAction to menu button item (#3331)
## Description This prop has no effect when used with `HeaderBarButtonItemWithAction`, as it is supposed to change selection value in context of menu button. It is possible that there are some more behaviours introduced by this prop, but not spotted yet. https://github.com/user-attachments/assets/4b4e52bd-80f6-4613-943b-4479a849e732 ## Test code and steps to reproduce `BarButtonItems` example in our app. Add this prop to a menu button item. ## Checklist - [ ] Ensured that CI passes
1 parent ca62b83 commit bccbca0

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

guides/GUIDE_FOR_LIBRARY_AUTHORS.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -603,14 +603,13 @@ An array of objects describing native bar button items to display on the left or
603603

604604
`selected?: boolean` — Whether the button is selected. Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/isselected
605605

606-
`changesSelectionAsPrimaryAction?: boolean` — Whether selection changes as a primary action (iOS 15+). Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/changesselectionasprimaryaction
607-
608606
#### The button with a menu also support:
609607

610608
```
611609
menu?: {
612610
type: 'menu';
613611
label?: string;
612+
changesSelectionAsPrimaryAction?: boolean // Whether selection changes as a primary action (iOS 15+). Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/changesselectionasprimaryaction
614613
items: Array<
615614
| {
616615
label?: string;

src/types.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,13 +1080,6 @@ export interface HeaderBarButtonItemWithAction
10801080
* Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/isselected
10811081
*/
10821082
selected?: boolean;
1083-
/**
1084-
* A Boolean value that indicates whether the item represents an action or selection.
1085-
* Only available from iOS 15.0 and later.
1086-
*
1087-
* Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/changesselectionasprimaryaction
1088-
*/
1089-
changesSelectionAsPrimaryAction?: boolean;
10901083
}
10911084

10921085
export interface HeaderBarButtonItemMenuAction {
@@ -1145,6 +1138,13 @@ export interface HeaderBarButtonItemWithMenu extends SharedHeaderBarButtonItem {
11451138
title?: string;
11461139
items: (HeaderBarButtonItemMenuAction | HeaderBarButtonItemSubmenu)[];
11471140
};
1141+
/**
1142+
* A Boolean value that indicates whether the button title should indicate selection or not.
1143+
* Only available from iOS 15.0 and later.
1144+
*
1145+
* Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/changesselectionasprimaryaction
1146+
*/
1147+
changesSelectionAsPrimaryAction?: boolean;
11481148
}
11491149

11501150
export interface HeaderBarButtonItemSpacing {

0 commit comments

Comments
 (0)