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

[Xamarin.Forms] CollectionView doesnt scroll to item completly in carousel layout #76

Open
meierhoeferjannis opened this issue Aug 5, 2022 · 4 comments

Comments

@meierhoeferjannis
Copy link

Platform (please complete the following information):

  • OS: Android
  • Device: AndroidEmulator
  • Sdk vervion: Android Sdk 30
  • Xamarin.Forms: [5.0.0.2515]

Describe the bug
CollectionView doesnt scroll to an item completly in carousel layout, instead two items are half visible as you can see in the screenshot.
It seems like the SnapStyle Center causes this issue.

To Reproduce
I created a view and viewmodel, where in the viewmodel the currentindex of the CollectionView is set. When the view appears it seems like the collection view doesnt scroll but because of the snap style center the correct item is not entirely displayed. Instead the collection view is kind a stucked between two items.

I tried the same with a collectionview with horizontal layout and snap style start, and the scrolling just worked perfectly. So i assume the problem is the snap style center, which is mandatory for carousel layout at the moment.

Screenshots (if applicable)

image

@meierhoeferjannis
Copy link
Author

I discovered that this behaviour is kind of inteded, because in the CollectionViewRenderer in the ScrollToCurrentItem Method there is a offset calculated when the Snap Style is Center. Would it be possible to create a seperate SnapStyle which works like the SnapStyle Center but when it comes to scrolling no offset is calculated. Or a property in the CollectionView to disable offset calculation in the scrollToCurrentItem Method?

@meierhoeferjannis
Copy link
Author

If you say one of my given solutions would by fine to you, i can make the changes and provide a pr :)

@meierhoeferjannis
Copy link
Author

Hi just wanted to check if there are any news on this issue :)

@roubachof
Copy link
Owner

should be fixed in next version

@roubachof roubachof changed the title CollectionView doesnt scroll to item completly in carousel layout [Xamarin.Forms] CollectionView doesnt scroll to item completly in carousel layout Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants