Android: AppShell prevents gestures on native control
See original GitHub issueDescription
When using our native Android map control that uses motion events to detect and act on drag and pinch to navigate the control, the AppShell
view intercepts these events and prevents dragging and pinching beyond the first few pixels (if appears that if you drag or pinch very slowly you can get a little further before this event gets intercepted and stops responding).
The control works fine outside an AppShell
.
The native control is relying on GestureDetector
, ScaleGestureDector
and MotionEvents
/Touch
to react to user input. It returns true on these event handlers to mark them as handled when reacting to user input.
It was suggested by @PureWeen that locking the flyout behavior could address it based on, but that didn’t help. ie in AppShell constructor:
this.FlyoutBehavior = FlyoutBehavior.Locked;
When doing this though, I do notice that the touch events does go through the flyout and down into the map control (but still with the limited interaction).
Setting InputTransparent=true
or IsEnabled=false
on the appshell also doesn’t have any effect.
The same control wrapped in Xamarin.Forms AppShell does not exhibit this behavior.
Steps to Reproduce
- Open the following project: MauiApp21.zip
- Run the project.
- On the presented world map, attempt to pan an zoom
- Notice that the map will stop responding to pan and zoom interactions after a few pixels of finger movement.
- In
App.xaml.cs
, change the app to launchMainPage
instead ofAppShell
, and observe interactions now work fine.
Version with bug
Release Candidate 2 (current)
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android 11
Did you find any workaround?
Don’t use AppShell, but that’s hardly a workaround.
Relevant log output
No response
Update
As noted below looks like only horizontal gestures are getting blocked. Vertical pan and zoom/pinch works (but as soon as a horizontal threshold is performed all interaction stops)
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:11 (4 by maintainers)
Same issue here.
In my case, the pinch gesture fires the zoom feature in a chart, notice how it is only working when the pinch is vertical, and ignored when horizontal (3 MB gif):
@jfversluis,
We are also facing the same issue after the VS update.