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
21.99k stars 1.72k forks source link

[Android] Scrolls conflicts with nested ScrollView(s) (CarouselView, CollectionView, ListView) #9827

Open Phenek opened 2 years ago

Phenek commented 2 years ago

Description

We are not able to scroll a CollectionView that is nested inside a parent scrollView (CollectionView) on same direction. It's also affect CarouselView, ListView etc... ( did not test with MapView, but same stuff)

The parent scrollView intercept the scroll rather than dispatch to child, it should not.

Expected behavior

The deepest child should be able to intercept the touch and parents should ignore it. Even if the deepest view reaches its scroll limit in used direction only, parents should ignore it to prevent conflicts. On iOS this behavior is native, but need to be well implemented on Android part.

Order requirement:

  1. We should allow only one scrollView to scroll at a time.
  2. We need to detect the direction. |↔| | ↕ |
  3. Dispatch the touch event to the deepest child that allow/enable scroll on this direction
  4. Prevent all parents to scroll during this event.

Steps to Reproduce

  1. Create an Horizontal CarouselView (3 views) |↔|
  2. Incorpore on each view a Vertical CollectionView. | ↕ |
  3. On the header of those vertical collectionView, add a Header with an Horizontal CollectionView |↔|
  4. Try to scroll the header, you can not because it's the same direction as the carouselView.

NB: When touching the header, it should prevent parents from scrolling horizontally |↔|, but leave it possible to scroll the closer parent vertically | ↕ |

Link to public reproduction project repository

https://github.com/Phenek/ScrollConflicts.git

Version with bug

6.0.486 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 11

Did you find any workaround?

No response

Relevant log output

No response

ghost commented 2 years ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

Phenek commented 2 years ago

Related to this Xamarin.forms issue

[Bug Android] Scrolls conflicts with ScrollView(s) (CarouselView, CollectionView, ListView) #9315

Phenek commented 8 months ago

Many Android layouts could not be done with this issue. Touch events should be the same behavior as default iOS. Touch event must be consume by the deepest children, first.

All cross platform languages had this issue on Android a long time ago, they all get ride of it. It is crucial for our development process to achieve parity in layout capabilities, ensuring that we can replicate similar touch designs and touch functionalities with .Net MAUI

Friedrich78 commented 5 months ago

We currently try to migrate a custom Slider control based on Skiasharp (SkCanvasView). Touch events are swallowed by the ScrollView as soon as "Move" events start. It used to worked even on Xamarin with a custom ViewRenderer on Android!

Are there any workarounds for that issue on Android?

awasilik commented 5 months ago

Having the same issue if I place Map inside CarouselView. On iOS touch is intercepted by map and I am able to move map around and change view in carousel. On Android as soon as I start horizontal movement the carousel takes the gesture and map can not be moved

dhldn commented 3 months ago

I also had the same problem with the swiping mechanism in the CarouselView: https://github.com/dotnet/maui/issues/22507