xamarin / XamarinCommunityToolkit

The Xamarin Community Toolkit is a collection of Animations, Behaviors, Converters, and Effects for mobile development with Xamarin.Forms. It simplifies and demonstrates common developer tasks building iOS, Android, and UWP apps with Xamarin.Forms.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[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

  1. Attach a TouchEffect to an element in project targeting iOS
  2. Place the element from (1) into a ScrollView
  3. Place a breakpoint in ShouldRecognizeSimultaneously on the TouchUITapGestureRecognizerDelegate here
  4. Run the project while debugging.
  5. Scroll the ScrollView from (2) with a swipe.
  6. Tap the element with the TouchEffect from (1).
  7. 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