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

[Android] Receives the scrolled notification after some delay in horizontal scrolling #5187

Closed
ashok-kuvaraja opened this issue Mar 10, 2022 · 10 comments
Labels
area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter platform/android 🤖 s/triaged Issue has been reviewed s/try-latest-version Please try to reproduce the potential issue on the latest public version t/bug Something isn't working
Milestone

Comments

@ashok-kuvaraja
Copy link

ashok-kuvaraja commented Mar 10, 2022

Description

I have prepared a simple sample and written a custom grid to arrange a label based on the scroll view's ScrollX position. I have written a custom scroll view handler to achieve horizontal scrolling since the scrolled event did not work for horizontal orientation. The label is rendered to the screen after some delay when I fling a scroll view. But, If I do smooth scrolling, it layout properly.

Seems the scroll view is moved based on the user scrolling interactions but the scroll views scrolled event is triggered after some delay from that. I guess this is the reason for happening the delay. So, When I fling a scroll view, the label is layout to the corresponding position after showing a blank screen little time.

Due to this issue, I am facing a layouting issue in the virtualization concept in my application. Please review and fix the bug or gimme any workaround to resolve this issue.

Steps to Reproduce

  1. Run the below sample.
  2. Do fling in the horizontal direction

Sample:
ScrollingDemo.zip

Demo

XRecorder_10032022_060730.1.mp4

Version with bug

Preview 12

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Ensured in Android 7.1.1

Did you find any workaround?

No

Relevant log output

No response

@ashok-kuvaraja ashok-kuvaraja added s/needs-verification Indicates that this issue needs initial verification before further triage will happen t/bug Something isn't working labels Mar 10, 2022
@ashok-kuvaraja ashok-kuvaraja changed the title [Android] Receives the scrolled notification after some delay in horizontal scrolling [Android][Scrolling][Layout] Receives the scrolled notification after some delay in horizontal scrolling Mar 10, 2022
@ashok-kuvaraja ashok-kuvaraja changed the title [Android][Scrolling][Layout] Receives the scrolled notification after some delay in horizontal scrolling [Android][Scrolling] Receives the scrolled notification after some delay in horizontal scrolling Mar 10, 2022
@jfversluis
Copy link
Member

Maybe related to or even duplicate of #5090

@jfversluis jfversluis added area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter platform/android 🤖 and removed s/needs-verification Indicates that this issue needs initial verification before further triage will happen labels Mar 10, 2022
@ashok-kuvaraja
Copy link
Author

Hi @jfversluis,

Thanks for your rapid response,

As you mentioned, the horizontal scrolling is also not working. But, we achieved this through the workaround (Get the HorizontalScrollView's instance and invoke its scrollChange event and pass it to the virtual view's offset). Now, the horizontal scrolling is working on our side through the workaround.

public partial class CustomScrollViewHandler : Microsoft.Maui.Handlers.ScrollViewHandler
    {
        private HorizontalScrollView nativeHorizontalScrollView;

        protected override MauiScrollView CreateNativeView()
        {
            var nativeScrollView = base.CreateNativeView();
            nativeScrollView.ChildViewAdded += this.MauiScrollView_ChildViewAdded;
            return nativeScrollView;
        }

        private void MauiScrollView_ChildViewAdded(object? sender, ViewGroup.ChildViewAddedEventArgs e)
        {
            if (e.Child is HorizontalScrollView && e.Child != this.nativeHorizontalScrollView)
            {
                this.nativeHorizontalScrollView = (HorizontalScrollView)e.Child;
                this.nativeHorizontalScrollView.ScrollChange += this.HorizontalScrollView_ScrollChange;
            }
        }

        private void HorizontalScrollView_ScrollChange(object? sender, ScrollChangeEventArgs e)
        {
            this.VirtualView.HorizontalOffset = Microsoft.Maui.Platform.ContextExtensions.FromPixels(this.Context, e.ScrollX);
        }
    }

In our case, the delay has happened in layouting a label while doing a fling in the scroll view. I guess the issue will be resolved if both scroll view's content scrolling and the scrolled event invoking will happen simultaneously.

Regards,
Ashok K

@ashok-kuvaraja ashok-kuvaraja changed the title [Android][Scrolling] Receives the scrolled notification after some delay in horizontal scrolling [Android] Receives the scrolled notification after some delay in horizontal scrolling Mar 10, 2022
@Amir-Care Amir-Care added the s/triaged Issue has been reviewed label Mar 11, 2022
@Amir-Care
Copy link

Verified repro with Version 17.2.0 Preview 2.0 [32208.484.main] on Android 11

@Amir-Care Amir-Care added s/verified Verified / Reproducible Issue ready for Engineering Triage and removed s/triaged Issue has been reviewed labels Mar 11, 2022
@ashok-kuvaraja
Copy link
Author

Hi, Any further update on this?

@jfversluis
Copy link
Member

@ashok-kuvaraja not yet, we'll get to it!

@Redth Redth added this to the 6.0.300 milestone Mar 21, 2022
@ashok-kuvaraja
Copy link
Author

Hi Team, Any further update on this?

@jfversluis
Copy link
Member

If there is you will see it here. Not need to ask :)

@davidortinau davidortinau added the p/0 Work that we can't release without label Apr 29, 2022
@Redth Redth added p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint and removed p/0 Work that we can't release without labels May 3, 2022
@samhouts samhouts modified the milestones: 6.0.300, 6.0.300-servicing May 6, 2022
@samhouts samhouts removed the p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint label Jul 20, 2022
@hartez hartez removed their assignment Aug 2, 2022
@Redth Redth modified the milestones: 6.0-servicing, Backlog Aug 30, 2022
@ghost
Copy link

ghost commented Aug 30, 2022

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.

@samhouts samhouts removed the s/verified Verified / Reproducible Issue ready for Engineering Triage label Apr 5, 2023
@Zhanglirong-Winnie Zhanglirong-Winnie added s/triaged Issue has been reviewed s/try-latest-version Please try to reproduce the potential issue on the latest public version labels May 6, 2023
@ghost
Copy link

ghost commented May 6, 2023

Hi @ashok-kuvaraja. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version.

You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository.

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.

@Zhanglirong-Winnie
Copy link

Verified this issue with Visual Studio Enterprise 17.6.0 Preview 5.0. Not repro on Android Platform.
Repro project: ScrollingDemo.zip
Scrolled

@ghost ghost closed this as completed May 13, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Jun 12, 2023
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter platform/android 🤖 s/triaged Issue has been reviewed s/try-latest-version Please try to reproduce the potential issue on the latest public version t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants