Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flyout navigation not working properly[MAUI.Prism] Android #2820

Closed
SarthakB26 opened this issue Feb 15, 2023 · 5 comments · Fixed by #2849
Closed

Flyout navigation not working properly[MAUI.Prism] Android #2820

SarthakB26 opened this issue Feb 15, 2023 · 5 comments · Fixed by #2849

Comments

@SarthakB26
Copy link

SarthakB26 commented Feb 15, 2023

Doing _navigationService.NavigateAsync("NavigationPage/ViewB") From Flyout Page will result in opening ViewB as a push modal also no hamburger icon will be visible on ViewB page.

Steps To Reproduce

  1. Open Prism.Maui app
  2. Go to flyout page
  3. Click on hambergur icon and select ViewB Button from Flyout
  4. You will see instead of setting ViewB as detail page of Flyout page, ViewB will open as a PushModal page and no back or hamburger button will be visible on ViewB page

Testing on Latest Maui and Prism version
Maui Flyout works fine

Video attached of Sample Prism app

Android.Emulator.-.pixel_5_-_api_32_5554.2023-02-15.16-50-44.mp4

Please let me know if there is any workaround to fix this. Really important for migration

@SarthakB26
Copy link
Author

SarthakB26 commented Feb 15, 2023

While debugging what I found out is after doing _navigationService.NavigateAsync("NavigationPage/ViewB").
ProcessNavigation method called with single segment i.e ViewB even while one ProcessNavigation method already in run with two segments i.e NavigationPage and ViewB

This recursive calling might be the issue here but I am not sure why its calling again or this is might be how things work in prims

@dansiegel dansiegel transferred this issue from PrismLibrary/Prism.Maui Feb 16, 2023
@SarthakB26 SarthakB26 changed the title Flyout navigation not working properly Flyout navigation not working properly[MAUI.Prism] Android Feb 17, 2023
@berhir
Copy link
Contributor

berhir commented Mar 21, 2023

hi @SarthakB26, did you find a workaround for this issue?

@SarthakB26
Copy link
Author

For now you can get FlyoutPage from Application.MainPage as FlyoutPage and then sets its detail page by yourself rather then through prism navigation service.
It's dirty I know but works for me

@berhir
Copy link
Contributor

berhir commented Mar 21, 2023

Thanks. I did a short investigation and found the issue. This commit causes the issue: PrismLibrary/Prism.Maui@9113b7d
More precisely these lines:

if (!useModalNavigation.Value && !MvvmHelpers.HasNavigationPageParent(currentPage))
    useModalNavigation = true;

The FlyoutPage does not have a NavigationPage parent, that's why useModalNavigation is always true.
When I comment those lines, my app works as expected, but the tests are failing.

I guess instead of MvvmHelpers.HasNavigationPageParent(currentPage) we should use UseModalNavigation()and add a check for FlyoutPage.
I must do some more testing and then I can create a PR if you agree @dansiegel

@berhir
Copy link
Contributor

berhir commented Mar 22, 2023

The solution was even simpler. I created a PR with the fix. And I added a new test that fails without my changes and succeeds with my changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants