Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Fix #3763: Update initial height of menu when page actions are visible
Browse files Browse the repository at this point in the history
  • Loading branch information
kylehickinson committed Jun 9, 2021
1 parent 294c87a commit 0cbcb07
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,8 @@ extension BrowserViewController: ToolbarDelegate {
if let url = selectedTabURL, let tab = tabManager.selectedTab {
activities = shareActivities(for: url, tab: tab, sourceView: view, sourceRect: self.view.convert(self.topToolbar.menuButton.frame, from: self.topToolbar.menuButton.superview), arrowDirection: .up)
}
let menuController = MenuViewController(content: { menuController in
let initialHeight: CGFloat = selectedTabURL != nil ? 470 : 370
let menuController = MenuViewController(initialHeight: initialHeight, content: { menuController in
VStack(spacing: 6) {
featuresMenuSection(menuController)
Divider()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ struct MenuItemButton: View {
class MenuViewController: UINavigationController, UIPopoverPresentationControllerDelegate {

private var menuNavigationDelegate: MenuNavigationControllerDelegate?
private let initialHeight: CGFloat

init<MenuContent: View>(@ViewBuilder content: (MenuViewController) -> MenuContent) {
init<MenuContent: View>(initialHeight: CGFloat, @ViewBuilder content: (MenuViewController) -> MenuContent) {
self.initialHeight = initialHeight
super.init(nibName: nil, bundle: nil)
viewControllers = [MenuHostingController(content: content(self))]
menuNavigationDelegate = MenuNavigationControllerDelegate(panModal: self)
Expand Down Expand Up @@ -199,7 +201,7 @@ extension MenuViewController: PanModalPresentable {
.maxHeight
}
var shortFormHeight: PanModalHeight {
isPresentingInnerMenu ? .maxHeight : .contentHeight(370)
isPresentingInnerMenu ? .maxHeight : .contentHeight(initialHeight)
}
var allowsExtendedPanScrolling: Bool {
true
Expand Down

0 comments on commit 0cbcb07

Please sign in to comment.