dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.2k stars 1.75k forks source link

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

Open PureWeen opened 3 months ago

PureWeen commented 3 months ago

Description

iOS version of https://github.com/dotnet/maui/issues/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

github-actions[bot] commented 3 months ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.