-
Notifications
You must be signed in to change notification settings - Fork 506
Improving the operation of PresentationControllers #1846
Conversation
|
||
protected override void Dispose(bool disposing) | ||
{ | ||
DismissHandler?.Invoke(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Experimentally, I found out that DidDismiss
method is not always called when closing parent controllers. And this is probably the only workaround to finish a TaskCompletionSource
.
public static void Init(Func<UIViewController> getCurrentUIViewController) | ||
=> getCurrentController = getCurrentUIViewController; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dimonovdd What would be a use case for this? Just for reference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was such a case in my application:
- A popup appears
- FilePicker appears
- The popup closes and it closes the picker
because the picker was opened from the popup controller, and not from main navigation controller
Will it be merged? It is a big problem. It has been fixed in many libraries for example in userdialogs:
Usage example: [assembly: ExportRenderer(typeof(NavigationPage), typeof(CustomNavigationRenderer))]
public class CustomNavigationRenderer : NavigationRenderer
{
public static CustomNavigationRenderer LastController { get; private set; }
public override void ViewDidLoad()
{
base.ViewDidLoad();
LastController = this;
}
} static UIViewController? GetTopViewController()
{
if (!(PopupNavigation.Instance?.PopupStack?.Any() ?? false))
return Xamarin.Essentials.Platform.GetCurrentUIViewController();
return CustomNavigationRenderer.LastController?.ViewControllers?.LastOrDefault();
} public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
\\...
UserDialogs.Init(GetTopViewController);
\\...
} |
Co-authored-by: Redth <jondick@gmail.com> Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
Co-authored-by: Redth <jondick@gmail.com> Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
Description of Change
Using
Rg.Plugins.Popup
andEssentials
together, I noticed some problems:This is due not only to
Rg.Plugins.Popup
, but also to any projects that use custom controllers for rendering pages.API Changes
Added:
Behavioral Changes
PR Checklist
main
at time of PR