maui icon indicating copy to clipboard operation
maui copied to clipboard

ScrollToAsync Not Working on Andrioid

Open robreno opened this issue 1 year ago • 5 comments

Description

The Maui ScrollView method scrollView.ScrollToAsync(label, ScrollToPosition.Start, true) works on Windows but fails on Andoid.

I created a very simple demo here: https://github.com/robreno/ScrollToDemo

It is a simple two page app with a ScrollView with a VerticalStackLayout for this main container and then a series of Labels that have x:Name for scrolling to the Label name. When compiled and deployed on Windows the ScrollToAsync works as expected. On Android the app doesn't scroll to the Label name at all.

I have no idea is this a feature or bug ;-) But it seems this is pretty vanilla functionality that Maui framework should handle. Therefore I would call it a bug. But, if I am doing somethign wrong or need to perhaps write custom handlers and call native Android APIs I am willing to do so, but first need to know if this is a bug.

I tried both scrollView.ScrollToAsync(label, ScrollToPosition.Start, true) and scrollView.ScrollToAsync(labelX, labelY, false). Both these work on Windows, neither of them works on Android.

Steps to Reproduce

  1. Download the demo app, compile and deploy to Windows and then Android.
  2. GitHub Demo App: https://github.com/robreno/ScrollToDemo
  3. The code is pretty simple and self contained.
  4. Watch Video of code: https://youtu.be/Uwy_19Baxes

Link to public reproduction project repository

https://github.com/robreno/ScrollToDemo

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android version 12

Did you find any workaround?

No

Relevant log output

N/A. See demo repo.

robreno avatar Apr 15 '23 02:04 robreno

Verified this on Visual Studio Enterprise 17.7.0 Preview 2.0. Repro on Android 13.0-API33 with below Project: ScrollToDemo.zip

Android and Windows scroll to different position: image image

XamlTest avatar Jun 29 '23 08:06 XamlTest

Hmm mine doesnt work on Android or iOS.

Update:

It seems we have to wait for the contents to rendered on the view first before calling ScrollToAsync

Syed-RI avatar Jun 30 '23 10:06 Syed-RI

Yet another bug that is open for over 8 months. At this rate I will NEVER be able to ship my app into production. This is HELL.

cworth33 avatar Dec 21 '23 02:12 cworth33

Looks like three's no one actually working on fixing bugs, I think most devs have moved to a different project and the remaining are busy writing blogs or making Youtube videos on how cool MAUI is.

Manish-Pradhan-FP avatar Jan 11 '24 16:01 Manish-Pradhan-FP

From what I've tried, it works as intended if it's inside the ContentPage's SizeChanged event. I don't think #19515 is related.

cat0363 avatar Jan 12 '24 00:01 cat0363