Popup was closing when background was touched instead of tapped
This commit is contained in:
@@ -42,8 +42,8 @@ namespace Mopups.Platforms.iOS
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
_renderer.ViewController.View?.RemoveGestureRecognizer(_tapGestureRecognizer);
|
||||
_renderer = null;
|
||||
View?.RemoveGestureRecognizer(_tapGestureRecognizer);
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
@@ -53,7 +53,7 @@ namespace Mopups.Platforms.iOS
|
||||
|
||||
private void OnTap(UITapGestureRecognizer e)
|
||||
{
|
||||
var view = e.View;
|
||||
var view = e.View.Subviews.First();
|
||||
var location = e.LocationInView(view);
|
||||
var subview = view.HitTest(location, null);
|
||||
|
||||
@@ -108,14 +108,14 @@ namespace Mopups.Platforms.iOS
|
||||
ModalPresentationStyle = UIModalPresentationStyle.OverCurrentContext;
|
||||
ModalTransitionStyle = UIModalTransitionStyle.CoverVertical;
|
||||
|
||||
View?.AddGestureRecognizer(_tapGestureRecognizer);
|
||||
_renderer.ViewController.View?.AddGestureRecognizer(_tapGestureRecognizer);
|
||||
}
|
||||
|
||||
public override void ViewDidUnload()
|
||||
{
|
||||
base.ViewDidUnload();
|
||||
|
||||
View?.RemoveGestureRecognizer(_tapGestureRecognizer);
|
||||
_renderer.ViewController.View?.RemoveGestureRecognizer(_tapGestureRecognizer);
|
||||
}
|
||||
|
||||
public override void ViewWillAppear(bool animated)
|
||||
|
||||
@@ -26,12 +26,6 @@ namespace Mopups.Platforms.iOS
|
||||
|
||||
public override UIView HitTest(CGPoint point, UIEvent? uievent)
|
||||
{
|
||||
|
||||
if (_stop)
|
||||
{
|
||||
return base.HitTest(point, uievent);
|
||||
}
|
||||
|
||||
var platformHandler = (PopupPageRenderer?)RootViewController;
|
||||
var renderer = platformHandler?.Handler;
|
||||
var hitTestResult = base.HitTest(point, uievent);
|
||||
@@ -42,18 +36,10 @@ namespace Mopups.Platforms.iOS
|
||||
if (formsElement.InputTransparent)
|
||||
return null!;
|
||||
|
||||
if ((formsElement.BackgroundInputTransparent || formsElement.CloseWhenBackgroundIsClicked ) && renderer?.PlatformView == hitTestResult)
|
||||
if (formsElement.BackgroundInputTransparent && renderer?.PlatformView == hitTestResult)
|
||||
{
|
||||
if (formsElement.CloseWhenBackgroundIsClicked)
|
||||
{
|
||||
_stop = true;
|
||||
}
|
||||
|
||||
formsElement.SendBackgroundClick();
|
||||
if (formsElement.BackgroundInputTransparent)
|
||||
{
|
||||
return null!; //fires off other handlers? If hit test returns null, it seems that other elements will process the click instead
|
||||
}
|
||||
return null!;
|
||||
}
|
||||
return hitTestResult;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user