Skip to content

[iOS] CarouselView doesn't scroll to the right Position after changing the ItemSource with Loop enabled #24105

@PureWeen

Description

@PureWeen

Description

iOS version of #17283

After the Carousel ItemSource is loaded for the first time, try to reset or assign a new ItemSource and set the Position to a specific value right after that with the Loop property enabled, the Carousel won't scroll to the right item. If we disable the Loop property, the scroll works fine. I could reproduce it on Android and iOS.

Steps to Reproduce

1 - Create a new project .NET MAUI App
2 - Add a Carousel to the page with the Loop = True
3 - Load a list of 3+ items into the Carousel ItemSource
4 - Swipe it to the last position
5 - Replace the item source list or assign a new one. It could be the same list, but it needs to reset the ItemSource.
6 - Try to set the position again to the last item programmatically right after reloading the list.
7 - If you disable the loop it works.

Expected outcome: The last item should be selected
Actual outcome: The first item will be selected, and the swipe feature will get lost

Link to public reproduction project repository

https://github.com/l0gaw/CarouselPositionLoopIssue

Version with bug

7.0.92

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 16.6

Did you find any workaround?

Disable the Loop property.

Relevant log output

No response

Metadata

Metadata

Assignees

Labels

area-controls-collectionviewCollectionView, CarouselView, IndicatorViewp/2Work that is important, but is currently not scheduled for releaseplatform/ioss/triagedIssue has been reviewedt/bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions