Bug 57114 - Forms gestures are not supported on UIViews that have native gestures
Summary: Forms gestures are not supported on UIViews that have native gestures
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS ()
Version: 2.3.4
Hardware: All All
: Normal normal
Target Milestone: ---
Assignee: E.Z. Hart [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2017-06-02 17:56 UTC by Matthew Leibowitz
Modified: 2017-06-20 15:42 UTC (History)
5 users (show)

Tags: gesture native ac
Is this bug a regression?: ---
Last known good build:


Attachments
Simple Demo (51.02 KB, application/zip)
2017-06-02 17:56 UTC, Matthew Leibowitz
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Matthew Leibowitz 2017-06-02 17:56:45 UTC
Created attachment 22661 [details]
Simple Demo

It appears that UIViews that support user interaction (UserInteractionEnabled == true) cannot support forms gestures. 

The forms gesture recognizer first checks to see what was tapped, and since the UIView supports touch, that view is returned. But this is a problem since the forms gesture recognizer is attached to the renderer and checks that the event comes from the renderer. This leaves the recognizer forever in a place that will never receive touch events, because none of the touches will be from the renderer.

The native iOS view:

    var nativeGestureView = new UIView() {
        UserInteractionEnabled = true
    };

The forms view:

    <local:GestureView>
        <local:GestureView.GestureRecognizers>
            <TapGestureRecognizer Tapped="OnTapped" />
        </local:GestureView.GestureRecognizers>
    </local:GestureView>
Comment 1 Matthew Leibowitz 2017-06-02 18:01:19 UTC
This line of code does the check:
https://github.com/xamarin/Xamarin.Forms/blob/beta-2.3.5-pre4/Xamarin.Forms.Platform.iOS/EventTracker.cs#L86

    _shouldReceive = (r, t) => t.View is IVisualElementRenderer;

Basically, `t` is `UITouch` and the `View` is the renderer. `r` is `UIGestureRecognizer` and is the "forms" gesture recognizer.

If the native view has `UserInteractionEnabled = true`, then `t.View` will be the native view. If `UserInteractionEnabled = false`, then `t.View` will be the forms renderer view.
Comment 2 E.Z. Hart [MSFT] 2017-06-14 00:11:47 UTC
PR: https://github.com/xamarin/Xamarin.Forms/pull/990
Comment 3 Rui Marinho 2017-06-20 15:42:12 UTC
Should be fixed on 2.3.6-pre1