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 - CollectionView scroll wrong item when set animation is false #26191

Closed
hiepis opened this issue Nov 28, 2024 · 9 comments
Closed

Android - CollectionView scroll wrong item when set animation is false #26191

hiepis opened this issue Nov 28, 2024 · 9 comments
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView platform/android 🤖 s/triaged Issue has been reviewed s/try-latest-version Please try to reproduce the potential issue on the latest public version s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working

Comments

@hiepis
Copy link

hiepis commented Nov 28, 2024

Description

ScrollTo(int index, int groupIndex = -1,ScrollToPosition position = ScrollToPosition.MakeVisible, bool animate = true) seem not working when animate = false
I add many entry in collectionview, the keyboard has strange behaviour.

Using .net8
Microsoft.Maui.Controls 8.0.100

Steps to Reproduce

collectionview_scroll.mp4

Link to public reproduction project repository

https://github.com/hiepis/CollectionView_scroll-.git

Version with bug

8.0.100 SR10

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android

Did you find any workaround?

No response

Relevant log output

@hiepis hiepis added the t/bug Something isn't working label Nov 28, 2024
Copy link

We've found some similar issues:

If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue.

Note: You can give me feedback by 👍 or 👎 this comment.

@Zhanglirong-Winnie Zhanglirong-Winnie added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Nov 29, 2024
@Zhanglirong-Winnie
Copy link

This issue has been verified using Visual Studio 17.13 Preview 1 (9.0.10 & 8.0.100 & 8.0.92). Can repro this issue on Android platform.

@kubaflo
Copy link
Contributor

kubaflo commented Nov 29, 2024

Hi, @hiepis It looks to me that it doesn't work only in a particular case when you do entry.Focus(); before scrolling

	private void OnItem2Tapped(object sender, TappedEventArgs e)
	{
		var stackLayout = sender as StackLayout;
		var entry = stackLayout?.Children[0] as Entry;
		if (entry != null)
		{
                        entry.Focus();
			var index = ((IList<string>)collectionView.ItemsSource).IndexOf(entry.Placeholder);
			collectionView2.ScrollTo(index, position: ScrollToPosition.Start, animate: SwitchAnimation.IsToggled);
			currentIndex = index;
		}
	}

@hiepis
Copy link
Author

hiepis commented Dec 2, 2024

@kubaflo I create 2 list. First list I set focus after call ScrollTo

@tj-devel709
Copy link
Member

@hiepis Thanks for the feedback. If I'm following correctly, would doing what @kubaflo suggested work as a workaround in this situation? Seems like there may be some timing things going on when focusing before scrolling to the index without the animations. Is there a particular scenario you want this focus before the scroll?

@hiepis
Copy link
Author

hiepis commented Dec 4, 2024

@tj-devel709 Remove event OnItem2Tapped and add scrolling to item when entry focused(ScrollToPosition is Start). If you touch on Entry, The Entry will focused first then scrolling. It's show bug like second collection

@jfversluis
Copy link
Member

I see this talks about .NET 8, could you also try .NET 9? Maybe its resolved in ther?

@jfversluis jfversluis added the s/try-latest-version Please try to reproduce the potential issue on the latest public version label Dec 9, 2024
Copy link
Contributor

Hi @hiepis. 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.

@jfversluis jfversluis added the area-controls-collectionview CollectionView, CarouselView, IndicatorView label Dec 9, 2024
@pierre01
Copy link

I have the same issue but also without the groups (verified in 9.0.12) Android only...
ExercisesCollectionView.ScrollTo(e, position: ScrollToPosition.MakeVisible);

CollectionViewBug.mp4

@github-actions github-actions bot locked and limited conversation to collaborators Jan 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView platform/android 🤖 s/triaged Issue has been reviewed s/try-latest-version Please try to reproduce the potential issue on the latest public version s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants