[Android] Fix for the CarouselView doesn't scroll to the right Position after changing the ItemSource with Loop enabled#24160
Closed
Ahamed-Ali wants to merge 5 commits intodotnet:mainfrom
Closed
[Android] Fix for the CarouselView doesn't scroll to the right Position after changing the ItemSource with Loop enabled#24160Ahamed-Ali wants to merge 5 commits intodotnet:mainfrom
Ahamed-Ali wants to merge 5 commits intodotnet:mainfrom
Conversation
Member
|
/azp run |
This comment was marked as outdated.
This comment was marked as outdated.
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
Azure Pipelines successfully started running 3 pipeline(s). |
PureWeen
requested changes
Aug 18, 2024
|
|
||
| [Test] | ||
| [Category(UITestCategories.CarouselView)] | ||
| public void Issue17283Test() |
Member
There was a problem hiding this comment.
Give the test a more significant name indicating what's being tested here.
This is the name that shows up in the test results so it's easier if it has a valid description
Contributor
Author
|
Closing this due to duplicate PR created - #24431 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root Cause
When reloading the ItemSource, the
CurrentItemwas set to null in theUpdateAdapter, which caused theUpdateInitialPositionmethod to miss calculating theitemCountbased on theCurrentItem. As a result, theLoopScalevalue was incorrect in theLoopedPositionmethod, causingcenterPositionto be set to 0 in theGetGoToIndexmethod of the CarouselViewLoopManager class. This led to a negative index position in theGetGoToIndexand prevented scrolling.Description of change
Updated the
ItemCountbased on the carousel loop, position, and ItemSource, ensuring the proper calculation of ItemCount, which helps maintain the correct looped position when reloading the itemsIssue Fixed
Fixes #17283
Before Fix
CarouselWithIssue.mp4
After Fix
CarouselLoopafterfix.mp4