Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Android] Changes in CarouselView initial position #13384

Merged
merged 1 commit into from
Jan 18, 2021

Conversation

jsuarezruiz
Copy link
Contributor

Description of Change

Recently, fixing a TabView issue xamarin/XamarinCommunityToolkit#630 (which internally uses CarouselView) in the Xamarin Community Toolkit, I noticed some unexpected behavior with the initial position of the CarouselView.

The problem is that the casting:

var items = Carousel.ItemsSource as IList;

It is not correct in all cases. This PR adds changes to use an enumerator.

API Changes

None

Platforms Affected

  • Android

Behavioral/Visual Changes

None

Before/After Screenshots

Not applicable

PR Checklist

  • Targets the correct branch
  • Tests are passing (or failures are unrelated)

break;
}
if(carouselEnumerator.Current == Carousel.CurrentItem)
position = itemCount;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this break so it doesn't loop the full collection ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need itemCount right after this iteration, so we need it to complete the loop.

@rmarinho rmarinho merged commit 9fb21b7 into 5.0.0 Jan 18, 2021
@rmarinho rmarinho deleted the fix-carouselview-initialposition branch January 18, 2021 00:26
@samhouts samhouts added this to the 5.0.0 milestone Jan 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants