Xamarin.forms: [Bug] Android Inconsistent CarouselView behaviour between stable and preview version

Created on 18 Dec 2019  ·  3Comments  ·  Source: xamarin/Xamarin.Forms


The CarouselView on Android is not rendering the same way between XF v4.4-pre3 and XF v4.4-stable.

Description

Steps to Reproduce

  1. Setup some carousel view
  2. Run with XF 4.4-pre3
  3. Upgrade XF to v4.4-stable

Expected Behavior

There should not be much different when the CarouselView is rendered.

Actual Behavior

The CarouselView code doesn't generate the same result.

Basic Information

  • Version with issue:
  • Last known good version:
  • IDE:
  • Platform Target Frameworks:

    • Android: 9

  • Nuget Packages:
  • Affected Devices:

Screenshots

With 4.4-pre3

Screenshot_1576665617

With 4.4-stable
Screenshot_1576665740

Reproduction Link


You can try running the app from this branch: https://github.com/ravinderjangra/safe-network-app-mobile/tree/login-create-account.
Just launch the app to see the difference either upgrade the XF package or revert the commit.

carouselview needs-info ❓ bug

All 3 comments

Since CarouselView is under the Exprimental flag it's normal that are some changes on the control, this case we fixed a issue with the Peek Area insets, and we made the behavior to be consistent between Android and iOS, where the item will be centered on the viewport.

I made a couple of changes that seems to fix your use case. but if you need a behavior like you had before where items start on the left side (without inset) you should try move to Horizontal CollectionView.

<CarouselView.PeekAreaInsets>
              <OnPlatform x:TypeArguments="Thickness">
                   <On Platform="iOS" Value="0, 0, 100, 0" />
                   <On Platform="Android" Value="0, 0, 100, 0" />
                </OnPlatform>
</CarouselView.PeekAreaInsets>
<CarouselView.ItemsLayout>
               <LinearItemsLayout Orientation="Horizontal"
                                       ItemSpacing="15"
                                       SnapPointsType="Mandatory"
                                       SnapPointsAlignment="Center" />
</CarouselView.ItemsLayout>

Thanks @rmarinho, this makes sense. I understand the control is still under development. I raised the issue to confirm if it's intended change or a real bug with the implementation.

I will definitely move to the collection view for this case. Also, I noticed even with the new version the items are coming from the left corner on iOS which seems inconsistent between the platforms.

@ravinderjangra yap i noticed that too, for iOS seems we need to specify like this

  <On Platform="iOS" Value="100, 0, 100, 0" />`

but i think we should open a new issue about this

Was this page helpful?
0 / 5 - 0 ratings

Related issues

juepiezhongren picture juepiezhongren  ·  66Comments

hartez picture hartez  ·  59Comments

Genfood picture Genfood  ·  91Comments

jassmith picture jassmith  ·  199Comments

EdoardoCinelli picture EdoardoCinelli  ·  92Comments