Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion ios/Shared/RCTMenuItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,19 @@ class RCTMenuAction {
subMenuActions.append(subaction.createUIMenuElement(handler))
}
var menu: UIMenu;
// Stable identifiers let updateVisibleMenu match submenu nodes in
// place, so a refresh while the menu is presented keeps the user's
// current submenu level instead of popping back to the root.
// Inline sections don't navigate, so they stay stock.
let menuIdentifier = identifier.map { UIMenu.Identifier(rawValue: $0.rawValue) }
if self.displayInline {
menu = UIMenu(title: title, image: image, options: .displayInline, children: subMenuActions)
} else {
menu = UIMenu(title: title, image: image, children: subMenuActions)
menu = UIMenu(title: title, image: image, identifier: menuIdentifier, children: subMenuActions)
}

if #available(iOS 15.0, *) {
menu.subtitle = subtitle
}

if #available(iOS 16.0, *) {
Expand Down