From f77cc6ef690456cdf659fc6401d44e56f81b2ed6 Mon Sep 17 00:00:00 2001 From: Vetle Finstad Date: Mon, 29 Jun 2026 10:50:11 +0200 Subject: [PATCH] Fix iOS Touch popover gesture completion --- CHANGELOG.md | 3 +++ .../iOS/TouchEffectGestureRecognizerDelegate.cs | 4 ++-- .../Touch/iOS/TouchEffectTapGestureRecognizer.cs | 14 +++++++++++--- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c95bdbd5c..c622631ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## [61.5.2] +- [Touch][iOS] Fixed popovers and context menus opened from `Touch.Command` breaking scrolling and swipe-back gestures after dismissal. + ## [61.5.1] - [Touch][iOS] Fixed scroll gestures on tappable rows getting stuck after dismissing context menus or picker popovers, and prevented taps behind open overlays from activating touch commands. diff --git a/src/library/DIPS.Mobile.UI/Effects/Touch/iOS/TouchEffectGestureRecognizerDelegate.cs b/src/library/DIPS.Mobile.UI/Effects/Touch/iOS/TouchEffectGestureRecognizerDelegate.cs index f0555d29c..ede893a3b 100644 --- a/src/library/DIPS.Mobile.UI/Effects/Touch/iOS/TouchEffectGestureRecognizerDelegate.cs +++ b/src/library/DIPS.Mobile.UI/Effects/Touch/iOS/TouchEffectGestureRecognizerDelegate.cs @@ -47,11 +47,11 @@ public override bool ShouldRecognizeSimultaneously(UIGestureRecognizer gestureRe UIGestureRecognizer otherGestureRecognizer) { if (gestureRecognizer is TouchEffectTapGestureRecognizer touchGesture && - otherGestureRecognizer is UIPanGestureRecognizer) + otherGestureRecognizer is UIPanGestureRecognizer && + otherGestureRecognizer.State == UIGestureRecognizerState.Began) { TouchPlatformEffect.HandleTouch(UIGestureRecognizerState.Cancelled, ref touchGesture.m_currentState, gestureRecognizer.View); - return false; } return true; diff --git a/src/library/DIPS.Mobile.UI/Effects/Touch/iOS/TouchEffectTapGestureRecognizer.cs b/src/library/DIPS.Mobile.UI/Effects/Touch/iOS/TouchEffectTapGestureRecognizer.cs index cf63ec145..cc7c2fafc 100644 --- a/src/library/DIPS.Mobile.UI/Effects/Touch/iOS/TouchEffectTapGestureRecognizer.cs +++ b/src/library/DIPS.Mobile.UI/Effects/Touch/iOS/TouchEffectTapGestureRecognizer.cs @@ -47,12 +47,18 @@ public override void TouchesBegan(NSSet touches, UIEvent evt) public override void TouchesEnded(NSSet touches, UIEvent evt) { base.TouchesEnded(touches, evt); - - if(!m_longPressDetected && m_currentState is not UIGestureRecognizerState.Cancelled) - m_onTap.Invoke(); + + var shouldInvokeTap = !m_longPressDetected && m_currentState is not UIGestureRecognizerState.Cancelled; TouchPlatformEffect.HandleTouch(UIGestureRecognizerState.Ended, ref m_currentState, m_uiView); m_longPressDetected = false; + + State = shouldInvokeTap ? UIGestureRecognizerState.Ended : UIGestureRecognizerState.Failed; + + if (shouldInvokeTap) + { + MainThread.BeginInvokeOnMainThread(m_onTap); + } } public override void TouchesCancelled(NSSet touches, UIEvent evt) @@ -60,6 +66,7 @@ public override void TouchesCancelled(NSSet touches, UIEvent evt) base.TouchesCancelled(touches, evt); TouchPlatformEffect.HandleTouch(UIGestureRecognizerState.Cancelled, ref m_currentState, m_uiView); + State = UIGestureRecognizerState.Cancelled; m_longPressDetected = false; } @@ -76,6 +83,7 @@ public override void TouchesMoved(NSSet touches, UIEvent evt) { TouchPlatformEffect.HandleTouch(UIGestureRecognizerState.Cancelled, ref m_currentState, m_uiView); m_isCancelled = true; + State = UIGestureRecognizerState.Failed; } base.TouchesMoved(touches, evt);