question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TapGestureRecognizer not working on a Frame in a grid on iOS or Mac

See original GitHub issue

Description

TapGestureRecognizer not working on a Frame in a grid.

Steps to Reproduce

Try the following code:

var frame = new Frame();
frame.GestureRecognizers.Add(new TapGestureRecognizer() { Command = new Command(() => Debug.WriteLine("dfg")) });

Add the frame to a grid, run iOS or Mac and attempt to tap/click on it. [EDIT], It might be more complex, it needs to be in a scrollview that spans all columns in the grid and in a custom layout control. Will put together an example when I get time. [EDIT 2] Ok, nothing to do with my custom control. A grid, containing scrollview that spans columns, containing a frame that has a tap gesture recogniser added will show the problem.

This is using VSforMac, so the .net version is 6.0.301.

Version with bug

Unknown/Other (please specify)

Last version that worked well

Unknown/Other

Affected platforms

iOS, macOS

Affected platform versions

iOS 15

Did you find any workaround?

Nope

Relevant log output

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:4
  • Comments:16 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
mattleibowcommented, Dec 14, 2022

Just tested on iOS with Xamarin.Forms and indeed the touches work. Now the trick is to figure out why it is not working in MAUI…

1reaction
awalker-dsgcommented, Dec 13, 2022

@mattleibow, re your comment, “As far as I can tell, this is how Xamarin.Forms worked.” We discovered this while migrating our code from Xamarin to MAUI. The Xamarin version of our app uses Frame in this way, and it does work on iOS as well as on Android.

Following up on your earlier comment, “Switching to a Border or a CollectionView seems to make it work again”, I modified the test code from my original post to use CollectionView instead of ListView. When I ran it on an iPhone 7 with iOS 15.6.1 and an emulated iPhone 14 with iOS 16.0, the app crashed on startup. I then restored it to use ListView and the app ran as before – i.e. the Frame ignores clicks, but the app didn’t crash on startup. These tests were done using VS 17.4.2.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Xamarin - Frame.GestureRecognizers doesn't work when ...
I have a Xamarin project with a view of a product's details. I have two buttons which can increase or decrease the quantity...
Read more >
TapGestureRecognizer doesn't work at first tap
My project deals with IOS 10.2 and the app user interface has been created using the interface builder through standard components to TapGesture...
Read more >
Nested Grid TapGestureRecognizer not working?
I'm new in Xamarin. I have been trying to get tap on every row of my grid but unfortunately not working. I have...
Read more >
TapGestureRecognizer in Xamarin Forms for IOS not ...
[regression] [worked-in:16.4.5] I am using Xamarin Forms and currently testing the IOS App. The Command never get executed in ...
Read more >
How to use gestures in SwiftUI
Learn Swift coding for iOS with these free tutorials.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found