[Bug] iOS TouchEffect implementation fails to set UIGestureRecognizerState
AdamEssenmacher opened this issue · comments
Description
The TouchUITapGestureRecognizer
class defined here does not properly maintain its state machine, which results in UIKit considering the gesture recognizer permanently active. This is likely the root cause of a half-dozen or so reported bugs across Xamarin.Forms and XCT.
The TouchUITapGestureRecognizer
inherits UIGestureRecognizer
, which makes it a UIKit 'custom' gesture recognizer as documented here. Important excerpt from these docs:
Use incoming events to update the state property of your gesture recognizer. UIKit uses the gesture recognizer states to coordinate interactions with other objects in your interface.
I will open a PR to fix shortly.
Possibly related XCT issues:
Possibly related Xamarin.Forms issues:
Stack Trace
N/A
Link to Reproduction Sample
See @mikepotvin's sample repo here
Steps to Reproduce
- Attach a TouchEffect to an element in project targeting iOS
- Place the element from (1) into a ScrollView
- Place a breakpoint in
ShouldRecognizeSimultaneously
on theTouchUITapGestureRecognizerDelegate
here - Run the project while debugging.
- Scroll the ScrollView from (2) with a swipe.
- Tap the element with the TouchEffect from (1).
- Scroll the ScrollView from (2) with a swipe.
Expected Behavior
Breakpoint from step (3) should only be hit during step (6).
Actual Behavior
Breakpoint from step (3) is hit during step (7), but not step (5). This shows UIKit believes the GestureRecognizer is still active (because it is).
Basic Information
- Version with issue: 1.0.0+
- Last known good version: None
- IDE: N/A
- Platform Target Frameworks:
- iOS: N/A, but this issue became much more problematic with back-gestures introduced in iOS 13
- Nuget Packages: N/A
- Affected Devices: N/A
Workaround
I can't think of any.
Reproduction imagery
N/A