question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] Is it possible to show a content page (modal) from the bottom sheet without close it first?

See original GitHub issue

Hello @paulvarache ,

First, I would like to thank you for the time and effort on this plugin, I have been using it on my first project and it works and looks fantastic for iOS and Android.

I am here to ask a question: I am using the bottom sheet to display some information and the information has some buttons that navigate to another screen (content page using modal), however, when I click the button or element it does not work. It triggers correctly the tap gesture event, however, it does not navigate to the modal screen.

This is how I want to navigate to a page (modal) from the tap event:

async void TapGestureRecognizer_Tapped(System.Object sender, Microsoft.Maui.Controls.TappedEventArgs e)
    {
        // await this.Dismiss(); if I dismiss it first it navigates OK.

        var viewModel = BindingContext as DashboardViewModel;
        if (viewModel.NavigateLocationLogsCommand.CanExecute(null))
            await viewModel.NavigateLocationLogsCommand.ExecuteAsync(null);
    }

Then on my viewmodel command I have the following line: await Shell.Current.GoToAsync($"{nameof(InformationPage)}");

The Information Page has this property set: Shell.PresentationMode="ModalAnimated"

I would like to navigate to that page and when the user closes it manually, return back and the bottom sheet still be open.

Any hint is always welcome.

Thanks in advance!!

Issue Analytics

  • State:open
  • Created 4 months ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
vhugogarciacommented, Jun 19, 2023

Hello @paulvarache , I was able to test your sample and it works partially in your sample, however, I found out the modal was not implemented correctly on the code sample you updated. With all respect and your permission, I went ahead and forked the repository and updated the sample here: https://github.com/vhugogarcia/The49.Maui.BottomSheet on the branch: modal-page

These are the changes: https://github.com/vhugogarcia/The49.Maui.BottomSheet/commit/bdbe679cf3d0ca8ad5471631972d4d68e628d440

In summary, I removed the flyoutmenuitem since for modal we should navigate using relative urls instead of absolute with ///. Also, I updated the command to use async.

If you download my update repository and run it on iOS emulator, you will find out that when you open the bottomsheet for Modal page and then TAP on Go To Modal button from the bottom sheet, you will see that nothing happens and the Visual Studio console will report this:

The49.Maui.BottomSheet.Sample[47070:500720] [Presentation] Attempt to present <Microsoft_Maui_Controls_Platform_ModalWrapper: 0x7fd21cfba910> on <Microsoft_Maui_Controls_Platform_Compatibility_ShellFlyoutRenderer: 0x7fd21dc1b2a0> (from <Microsoft_Maui_Controls_Platform_Compatibility_ShellFlyoutRenderer: 0x7fd21dc1b2a0>) which is already presenting <The49_Maui_BottomSheet_BottomSheetViewController: 0x7fd21db86ad0>.
The49.Maui.BottomSheet.Sample[47070:500720] [Presentation] Attempt to present <Microsoft_Maui_Controls_Platform_ModalWrapper: 0x7fd21db8dac0> on <Microsoft_Maui_Controls_Platform_ModalWrapper: 0x7fd21cfba910> (from <Microsoft_Maui_Platform_PageViewController: 0x7fd21cf99040>) whose view is not in the window hierarchy.

Let me know if there is anything else I can help with to reproduce the issue.

Note: Also, if you try to show an alert from the BottomSheet it won’t work. image

Thanks for looking into.

0reactions
vhugogarciacommented, Jun 29, 2023

Thanks @paulvarache for looking into the issue. And I think opening a ticket in .NET MAUI may help to solve this mystery.

And not a problem. We can in the meantime continue dismissing the bottom sheet and show a modal or so.

Really appreciate the time you put into this issue. Let me know if there is anything I can help with 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

showModalBottomSheet: show dialog before bottom sheet ...
I want to display a warning dialog if the bottom sheet is closed without the user having saved the edited data. The bottom...
Read more >
Bottom Sheets: Definition and UX Guidelines
A modal bottom sheet blocks any interactions with the background content while it is visible. A translucent dark scrim is usually placed ...
Read more >
Display bottom sheet above react navigation bottom tab bar
I'm currently trying to implement it in our app, and it works great on screens without a bottom tab bar, i.e the bottom...
Read more >
iOS 14 (SwiftUI) Sheet Modals not
Sometimes a modal is automatically (non-desired) closed right after it opens, and after that, the modal works fine (and so it is not...
Read more >
Flutter modal bottom sheet tutorial with examples
Learn how to create a modal bottom sheet in Flutter with this short guide, complete with practical examples.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found