-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
FlyoutPage IsPresented does not work when user opens flyout by clicking on hamburger #15767
Comments
We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process. |
Of the listed issues my thinking is that
is the only part here that is a bug and the rest of it is by design. We don't trigger visible/appearing just because something is obstructed. |
That would make sense if you were using one of the Split options, but again this is with the Popover option, in which the page completely disappears, same as when you do a NavigationPage.PushModalAsync and the page disappears underneath another page, and OnDisappearing runs, but in this case the page has another page on top of it and yet OnDisappearing never runs. This is inconsistent behaviour with OnDisappearing running when you do NavigationPage.PushModalAsync (in that case OnDisappearing runs, in this case it doesn't). I wanted to put code into OnAppearing - same as I do with NavigationPages in a stack when the page above it gets popped - only to find it only ever runs once. |
I have a partial workaround for this, which I have pushed to a "workaround" branch in the original repo. I say "partial" because it works if the user actually changes pages, but not if they just close the menu and stay on the same page (which is a symptom of "IsPresented" not being set to false on Windows when the user does that - one of the issues here needing fixing, the root issue). The workaround is on your FlyoutPage, subscribe a method to IsPresentedChanged, and then in that method you can manually call On(Dis)Appearing based on whether IsPresented is true or not, like so...
BTW I've realised that the reason OnDisappearing isn't running is because the hamburger icon itself is still visible... but the menu isn't! This for me is the important issue (which the workaround partially addresses). On Windows, with Flyout set to Popover, even though the hamburger icon remains visible the MenuPage itself completely disappears (because the page they have selected completely covers it, similar to when you do a PushModalAsync with a Page), and so I want the OnDisappearing for the ContentPage to run. This creates regular events (OnAppearing and OnDisappearing) where you can check if something needs changing in the Menu, such as someone has become a subscriber, or the opposite, their subscription has run out, and we can make corresponding changes to what appears in the Menu (such as display "Premium only" next to a feature not available on the free version... but I'm not sure if this is a feature request or a bug fix :-) ). |
Hello again. I have some more information to add in regards to my last statement (the part which I'm not sure if it's a feature request or a bug fix :-) ). This applies to both Windows AND Android (not just Windows-only, which is the original issue). In regards to my comment about wanting OnAppearing to run when the user clicks on the hamburger menu in Popover mode (given that the menu itself isn't visible to the user until then, given it's hidden under whatever the current Detail page is) I found, with further digging, that there's currently no way for the app (the dev) to know that the menu isn't presented upon start-up, even though it isn't. i.e. the Menu Page has had OnAppearing run, and thinks the Menu Page is visible, even though IsPresented is false. This is because, as per my previous comment, I have to hook into IsPresentedChanged to make these things run (OnAppearing and OnDisappearing), but because the app starts out with IsPresented set to false, there's no change to it's state until the first time a user clicks on the hamburger, and so the app actually starts out in this weird state where OnAppearing has run but IsPresented is false. So we either need OnAppearing to NOT run if IsPresented is false, or for IsPresented to get set back to it's correct stae of false after the constructor and OnAppearing has run so that OnDisappearing can run. As it is now those 2 states are out of sync with each other until the first click of the Menu. Here's some Debug output. Note the last 2 lines before hamburger clicked on - OnAppearing has run whilst IsPresented is false.
|
Verified this issue with Visual Studio Enterprise 17.9.0 Preview 4. Can repro on windows and android platforms with sample project. |
This is a bug and causing me issues at the moment. I'm working on a custom TitleView that needs to be able to show the flyout. It only works once on Windows because IsPresented is never set back to false if the flyout is closed by the user clicking outside of it. (using popover mode) |
Since my button in the TitleView is obscured when the flyout is open, I've been able to work around it just assuming IsPresented should be set to false when my button is clicked if(Window?.Page is FlyoutPage flyoutPage)
{
flyoutPage.IsPresented = false;
flyoutPage.IsPresented = true;
} |
Description
With FlyoutLayoutBehavior.Popover, whereby the Details page should entirely hide the Flyout(Menu)Page, most of the Disappearing lifecycle events never run. i.e.
Steps to Reproduce
Link to public reproduction project repository
https://github.com/SmartmanApps/FlyoutRepro
Version with bug
7.0.86
Last version that worked well
Unknown/Other
Affected platforms
Android, Windows, I was not able test on other platforms
Affected platform versions
1000.19041.1000.0 Android API 28
Did you find any workaround?
No (IsPresentedChanged works on Android, but only half usable on Windows).
Relevant log output
The text was updated successfully, but these errors were encountered: