dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.21k stars 1.74k forks source link

PanGestureRecognizer is not working in Android #16978

Open VishalOmprasad opened 1 year ago

VishalOmprasad commented 1 year ago

Description

We have added a simple Grid layout in the MainPage with PanGestureRecognizer. We have added Frame as the Grid's child element. Upon panning the PanUpdated event is not getting triggered.

https://github.com/dotnet/maui/assets/102582824/d0b5f753-86de-4585-b8df-52d8fb09200b

https://github.com/dotnet/maui/assets/102582824/bd567bd1-68c9-45a1-9343-0c5c5deff504

Steps to Reproduce

  1. Add a Grid layout to your MainPage’s content.
  2. Add PanGestureRecognizer to the Grid layout.
  3. Hook the PanGestureRecognizer.PanUpdated event.
  4. Run the sample and do swipe/pan action.
  5. Notice that the PanUpdated event will not be called.

[XAML]

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="GridTouchTest.MainPage">

    <Grid BackgroundColor="Red">
        <Grid.GestureRecognizers>
            <PanGestureRecognizer PanUpdated="PanGestureRecognizer_PanUpdated" />
        </Grid.GestureRecognizers>
        <Frame x:Name="getStartedFrame"
               Margin="0"
               Padding="0"
               Background="#10556C"
               BorderColor="Transparent"
               CornerRadius="10"
               HorizontalOptions="FillAndExpand"
               Opacity="0.7"
               VerticalOptions="FillAndExpand"
               HasShadow="False" />
    </Grid>
</ContentPage>

[C#]

public partial class MainPage : ContentPage
    {
        public MainPage()
        {
            InitializeComponent();
        }

        private void PanGestureRecognizer_PanUpdated(object sender, PanUpdatedEventArgs e)
        {

        }
    }

Link to public reproduction project repository

No response

Version with bug

7.0.92

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

No response

Did you find any workaround?

No

Relevant log output

No response

ghost commented 1 year ago

Hi @VishalOmprasad. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

ghost commented 1 year ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback to reproduce the issue but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.

adamzucchi commented 1 year ago

@PureWeen @Eilon - Can this be re-opened? Or do I have to create a new bug/issue?

I just created a repro project here which seems to be what was missing from this logged bug: MauiPanGestureBugSample

XamlTest commented 11 months ago

Verified this on Visual Studio Enterprise 17.9.0 Preview 1(8.0.3). Repro on Android 14.0-API34, not repro on Windows 11 with below Project: 16978.zip

RuddyOne commented 5 months ago

Here we are again.

Why is this not fixed? Why is it even broken?

Every turn I take with MAUI, issue after issue. Cant use the carousel view because of bugs on Windows etc. Create my own and cannot use Swipe gesture due to bugs on Windows etc, use the Pan gesture and now a bug on Android stops it from working.

Can you make it any more difficult to develop with MAUI? Very frustrating.

mfranc28 commented 4 months ago

Any news about this bug?