Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] CarouselView not handling GestureRecognizers and ScrollToRequested on swipe #7036

Closed
pierre01 opened this issue Aug 1, 2019 · 9 comments

Comments

@pierre01
Copy link

@pierre01 pierre01 commented Aug 1, 2019

CarouselView is not handling GestureRecognizers SwipeGestureRecognizer (IOS and Android)
also PanGestureRecognizer not working in Android (But works on IOS)

Steps to Reproduce

  1. Create a shell application
  2. Create a ContentPage with a CarouselView inside
  3. Set the CarouselView.ItemsSource to multiple items
  4. Create an event handler (optional) for ScrollToRequested in CarouselView
  5. Create CarouselView.GestureRecognizers SwipeGestureRecognizer and PanGestureRecognizer
  6. Implement event handler for Swiped in SwipeGestureRecognizer
  7. Implement event handler for PanUpdated in PanGestureRecognizer

Expected Behavior

While swiping right to left

  • ScrollToRequested handler should be called
  • Swiped handler should be called
  • PanUpdated handler should be called

Actual Behavior

On Android:
None of the handlers are called (ScrollToRequested is only called if you programmatically call ScrollTo(x) in the code behind.

On IOS:
Only PanUpdated is called

Basic Information

  • Version with issue: 4.1.0.618606

  • Last known good version: ?

  • IDE: Visual studio 2019 Windows 10

  • Platform Target Frameworks:

    • iOS: 8.0
    • Android: Android 9 API 28
  • Nuget Packages:

  • Affected Devices:

Screenshots

See animated GIF

CarouselSwipeBug

@samhouts

This comment has been minimized.

Copy link
Member

@samhouts samhouts commented Aug 1, 2019

@pierre01 Can you please attach a small project that demonstrates this issue?

Also, does this happen if you do not use Shell?

Thanks!

@samhouts samhouts moved this from New to Needs Info in Triage Aug 1, 2019
@pierre01

This comment has been minimized.

Copy link
Author

@pierre01 pierre01 commented Aug 2, 2019

https://github.com/pierre01/CarouselSample
I only added one form (CarouselPage.xaml) to the standard shell project and the app opens it first.
The page contains a CarouselView that illustrate the issues

@pierre01

This comment has been minimized.

Copy link
Author

@pierre01 pierre01 commented Aug 2, 2019

I have not tested yet whitout the shell

@PureWeen

This comment has been minimized.

Copy link
Contributor

@PureWeen PureWeen commented Aug 12, 2019

@pierre01 can you test with the latest 4.2 pre?

https://www.nuget.org/packages/Xamarin.Forms/4.2.0.673161-pre3

We fixed an issues with Gestures there and I'm curious if it fixes your issue

@pierre01

This comment has been minimized.

Copy link
Author

@pierre01 pierre01 commented Aug 12, 2019

I tested with 4.2.0.673161-pre3 But the issue is still there see my updated sample at
https://github.com/pierre01/CarouselSample

@pierre01

This comment has been minimized.

Copy link
Author

@pierre01 pierre01 commented Aug 12, 2019

Actually it is even worse as the PanUpdated event that was working on IOS, is not working anymore now.

@dpa456

This comment has been minimized.

Copy link

@dpa456 dpa456 commented Aug 13, 2019

Test Envori
vs - 2019, CarouselView - Ver-4.2.0.673161, Android - Pie
Carsousel TestSet

I have 3 tested way in CarouselView (Ver-4.2.0.673161) with Android (sorry i don't have mac)

  1. ScrollToRequested : Not worked
  2. Add PanGestureRecognizer - PanUpdated : Not worked
  3. Scrolled : Worked 👍
    Carsousel 4 2 0 673161-pre3

Have there function (ItemsViewScrolledEventArgs e)
Debug.WriteLine(" FirstVisibleItemIndex : " + e.FirstVisibleItemIndex + " CenterItemIndex : " + e.CenterItemIndex + " LastVisibleItemIndex : " + e.LastVisibleItemIndex + " HorizontalOffset : " + e.HorizontalOffset + " HorizontalDelta : " + e.HorizontalDelta + " VerticalDelta : " + e.VerticalDelta + " VerticalOffset : " + e.VerticalOffset);

I think 'LastVisibleItemIndex' is nextIndex actually what is different FirstVisibleItem & CenterItemIndex?

Thank you Update :) , very well worked Scrolled!

@pierre01

This comment has been minimized.

Copy link
Author

@pierre01 pierre01 commented Aug 14, 2019

The Scrolled event works on IOS and Android. This solves my issues.
I consider it as a good Workaround.
Closing the bug Thanks @dpa456 & @PureWeen

@pierre01 pierre01 closed this Aug 14, 2019
Triage automation moved this from Needs Info to Closed Aug 14, 2019
@pierre01

This comment has been minimized.

Copy link
Author

@pierre01 pierre01 commented Aug 14, 2019

Although the event arguments (e.FirstVisibleItemIndex, e.CenterItemIndex, e.LastVisibleItemIndex) to the scrolled event are inconsistent across platforms
on Ios:
screen 0 = 0,0,1
screen 1 = 0,1,2
screen 2 = 1,2,2
on android:
screen 0 = 0,0,0
screen 1 = 1,1,1
screen 2 = 2,2,2

@samhouts samhouts removed this from Closed in Triage Sep 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.