From 7c7715ce83cf54ce52ccf91c164889156fb5844c Mon Sep 17 00:00:00 2001 From: Adam Essenmacher Date: Tue, 7 Mar 2023 18:18:52 -0500 Subject: [PATCH] Update UIGestureRecognizer state machine so UIKit can properly handle state changes. --- .../Effects/Touch/PlatformTouchEffect.ios.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/CommunityToolkit/Xamarin.CommunityToolkit/Effects/Touch/PlatformTouchEffect.ios.cs b/src/CommunityToolkit/Xamarin.CommunityToolkit/Effects/Touch/PlatformTouchEffect.ios.cs index 7960ad760..956bd7c47 100644 --- a/src/CommunityToolkit/Xamarin.CommunityToolkit/Effects/Touch/PlatformTouchEffect.ios.cs +++ b/src/CommunityToolkit/Xamarin.CommunityToolkit/Effects/Touch/PlatformTouchEffect.ios.cs @@ -137,6 +137,7 @@ public override void TouchesBegan(NSSet touches, UIEvent evt) HandleTouch(TouchStatus.Started, TouchInteractionStatus.Started).SafeFireAndForget(); + State = UIGestureRecognizerState.Began; base.TouchesBegan(touches, evt); } @@ -149,6 +150,7 @@ public override void TouchesEnded(NSSet touches, UIEvent evt) IsCanceled = true; + State = UIGestureRecognizerState.Ended; base.TouchesEnded(touches, evt); } @@ -161,6 +163,7 @@ public override void TouchesCancelled(NSSet touches, UIEvent evt) IsCanceled = true; + State = UIGestureRecognizerState.Cancelled; base.TouchesCancelled(touches, evt); } @@ -180,6 +183,7 @@ public override void TouchesMoved(NSSet touches, UIEvent evt) { HandleTouch(TouchStatus.Canceled, TouchInteractionStatus.Completed).SafeFireAndForget(); IsCanceled = true; + State = UIGestureRecognizerState.Cancelled; base.TouchesMoved(touches, evt); return; } @@ -195,6 +199,7 @@ public override void TouchesMoved(NSSet touches, UIEvent evt) if (status == TouchStatus.Canceled) IsCanceled = true; + State = UIGestureRecognizerState.Changed; base.TouchesMoved(touches, evt); }