xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.63k stars 1.87k forks source link

[Bug] Scrolling issues in Android 9.0 Pie #7166

Open VasenevEA opened 5 years ago

VasenevEA commented 5 years ago

Description

When Android phone having version 9.0 Pie, the scrolling is stuck and scroll in the wrong direction.

Steps to Reproduce

  1. Create ListView with 50+ items (more than one screen)
  2. Set Rotation of ListView to 180
  3. Set Rotation of ItemTemplate to 180
  4. Swipe fast ( up -> buttom) , that request Fling action

Expected Behavior

Typical behavior of scrolling

Actual Behavior

Scroll direction changed to 180 degrees

Basic Information

Reproduction Code

ChatUIXForms

PureWeen commented 5 years ago

@VasenevEA have you tried this with CollectionView?

VasenevEA commented 5 years ago

@VasenevEA have you tried this with CollectionView?

Yes. Same behavior

paleicikas commented 5 years ago

any changes pending?

paleicikas commented 5 years ago

Android bugfix: https://android-review.googlesource.com/c/platform/frameworks/native/+/800996/1/libs/input/VelocityTracker.cpp

React bugfix: https://github.com/facebook/react-native/commit/b971c5b

Liminiens commented 4 years ago

@paleicikas do you know if it's possible to create a workaraound while this issue is not fixed?

mabdollahiasl commented 4 years ago

I have this problem too,

joeerwood commented 4 years ago

I've got the same issue too. Are there any workarounds?

vshapenko commented 4 years ago

Any updates on issue? This issue makes collection view unusable on some devices with specific android/vendor combination (i.e. samsung/android 9)

tvm-anand commented 4 years ago

Any workarounds?

taublast commented 4 years ago

Hi from the same same boat, if you have any workarounds for Android while it's not fixed please share any ideas! Maybe some custom renderer with custom velocity tracker or something..

taublast commented 4 years ago

Hey a very diagnostic sign, could help debugging - the scroll bar position!

Layout: ListView Rotation="180" FlowDirection="RightToLeft", Cell Template Rotation="180" FlowDirection="LeftToRight"

Result: case 1: nice chat list with scroll bar on the right side.

case 2 - android 9 bug: nice(?) chat list, but.. scroll bar on the left side, and while scroll works as intended when dragging, when you swipe it scrolls to the wrong direction.

tvm-anand commented 4 years ago

I dropped the idea of moving with rotation.In my case I am trying to implement chat UI. I implemented the chat according to this repo (https://github.com/jamesmontemagno/app-monkeychat ). There is no need to rotate the list

taublast commented 4 years ago

Thanks, unfortunately didn't solve what the rotated list does:

mabdollahiasl commented 4 years ago

any updates?

mabdollahiasl commented 4 years ago

after a lot of work I could solve the problem. I Use CollectionView with custom rendrer in android:

[assembly: ExportRenderer(typeof(CollectionView), typeof(ExCollectionViewRenderer))]

namespace Healx.Droid.CustomRenderer
{
    public class ExCollectionViewRenderer : CollectionViewRenderer
    {
        public ExCollectionViewRenderer(Context context) : base(context)
        {

        }
        private int dy = 0;
        public override void OnScrolled(int dx, int dy)
        {
            this.dy = dy;

            base.OnScrolled(dx, dy);
        }
        public override bool Fling(int velocityX, int velocityY)
        {

            return base.Fling(velocityX, Math.Abs(velocityY) * Math.Sign(dy));

        }

        protected override void OnElementChanged(ElementChangedEventArgs<ItemsView> elementChangedEvent)
        {

            base.OnElementChanged(elementChangedEvent);
        }
    }

}
Liminiens commented 4 years ago

Can confirm that fix above works

xamiell commented 4 years ago

I have this problem too. Running on Android 9.0 the same behavior.

angelru commented 3 years ago

The same issue...