-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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] Fix for the CarouselView doesn't scroll to the right Position after changing the ItemSource with Loop enabled. #24431
Conversation
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Azure Pipelines successfully started running 3 pipeline(s). |
@@ -0,0 +1,27 @@ | |||
#if ANDROID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to run this test on iOS and WinUI as well?
We typically let these tests run on all platforms even if the original issue is only happening on Android. This also lets us make sure that we have consistent behavior between all platforms.
If it's broken on iOS and/or WinUI then log a bug and make a note of the bug inside this test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I have modified the script to run the test on both iOS and WinUI. Could you please take a look and let me know?
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks like windows is crashing
Just ignore windows and log an issue and then we'll be able to merge this one!
I have created a bug report for the CarouselView issue on Windows and added a note in the test. Could you please take a look into it ? |
Azure Pipelines successfully started running 3 pipeline(s). |
|
Root Cause
When reloading the ItemSource, the
CurrentItem
was set to null in theUpdateAdapter
, which caused theUpdateInitialPosition
method to miss calculating theitemCount
based on theCurrentItem
. As a result, theLoopScale
value was incorrect in theLoopedPosition
method, causingcenterPosition
to be set to 0 in theGetGoToIndex
method of the CarouselViewLoopManager class. This led to a negative index position in theGetGoToIndex
and prevented scrolling.Description of change
Updated the ItemCount based on the Carousel loop and position, ensuring proper calculations to maintain the correct looped position value when reloading the items.
Issue Fixed
Fixes #17283
Before Fix
CarouselWithIssue.mp4
After Fix
CarouselLoopafterfix.mp4