Open Axemasta opened 6 months ago
I've updated my repro with a .NET for iOS sample of this problem, and it works just like the swift example so the SDK is find, this is an issue specifically in Maui.
Whats strange is I've updated my maui code so that when WillMoveToParentViewController
is called, I grab the NavigationRenderer
from that parent view controller, so I definitely have the top level UINavigationController
for the stack & set the delegate, it still is not called.
Any ideas on what could be happening here @PureWeen ?
Looks like this was an issue in Xamarin ([Bug] Page not popped on iOS 13 FormSheet swipe down).
I wonder if the reason I can't set the delegate manually is because its the wrong view controller and one of the wrapper vc's is actually what recieves the dismiss event.
In my Prism app, when I swipe the popover closed (not hard close it), the modal stack count will be set to 1 instead of 0, so this is the same bug in effect.
The following workaround suggested for forms doesn't work here, you get an infinite loop:
protected override async void OnDisappearing()
{
base.OnDisappearing();
while (Navigation.ModalStack.Count > 0)
{
Debug.WriteLine("Popping orphaned modal");
await Navigation.PopModalAsync(false);
}
}
Verified this issue with Visual Studio 17.10.0 preview2(8.0.14/8.0.3). Can repro on iOS platform with sample project.
Description
If I show a modal page on iOS with
ModalPresentationStyle
set toPageSheet
, or any presentation where the page can be dismissed via a gesture, there is no event to hook into to know that page has been dismissed at the maui level (as far as I am aware).This leads to a situation where frameworks like Prism don't detect page transitions and can get stuck. MVVMCross had this issue in Xamarin Forms and fixed it here. I have tried porting this code to my maui app and the
UIAdaptivePresentationControllerDelegate
dismiss method is never fired.I have tried setting it in 2 ways, 1 inheriting the
NavigationHandler
and setting thePresentationController
delegate:Another way I tried was using a content page renderer and setting a view controller which would set this delegate:
In my reproduction I provide a native swift example where the code to observe the dismiss events is super easy:
I am looking to implement this functionality in maui, since its not working I wonder if it is an issue with the .NET ios sdk, otherwise is there a better way to set this delegate where it would actually work.
Steps to Reproduce
UIAdaptivePresentationControllerDelegate
for the associatedUIViewController
Link to public reproduction project repository
https://github.com/Axemasta/DismissPresentationControllerRepro
Version with bug
8.0.6
Is this a regression from previous behavior?
Yes, this used to work in Xamarin.Forms
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
iOS 13+
Did you find any workaround?
No
Relevant log output
No response