Xamarin.forms: [BUG][iOS] CarouselView Layout on orientation change

Created on 16 Dec 2019  路  14Comments  路  Source: xamarin/Xamarin.Forms

8025 # Description

The CarouselView doesn't relayout when changing the device orientation.

Steps to Reproduce

  1. Run Project
  2. Tilt your Device to landscape/portrait mode

Expected Behavior

The View should adjust to the new heights/widths, like on Android.

Actual Behavior

The View doesn't relayout. Some parts become invisible or look

Basic Information

  • Nuget Packages: 4.4.0.991265
  • Last known good version: /
  • IDE: Visual Studio 2019 Pro 16.4.1
  • Platform Target Frameworks:

    • iOS: 13.8.3
  • Affected Devices: iPhone/iPad

Screenshots

IMG_0025
IMG_0026

Reproduction Link

CarouselBug.zip

carouselview layout blocker 2 in-progress iOS 馃崕 tablet bug

Most helpful comment

@rmarinho Sorry but this bug still reproduce on version 4.5.0.356.
I have added CarouselView into Grid and it's not resize when orientation changed.
Please check again.

All 14 comments

@hartez think this one is more related with ItemsView, imo we need to set constrains again when the BoundsSize change .

Any thoughts on this?

@rmarinho I think you're right. ItemsView is supposed to re-compute the constraints on a bounds change, so it looks like there's a bug. I think I saw another issue filed specifically about CollectionView.

I'll take a look at it.

This only works if the CarouselView is a direct child of ContentPage.Content.
If you put the CarouselView in a Grid/StackLayout the issue persists.

When i'm on "User 2" of the sample and go to landscape i looks like this:

IMG_0028

I have a CarouselView inside a Grid (with an IndicatorView) and as @Martin080793 said, this issue persists.

I tested with 4.4.0 Service Release 3 and 4.6.0.274-nightly.

I have a CarouselView inside a Grid with IndicatorView too and I report the same issue.

Please reopen

@luccasclezar and @Martin080793 Have you tried to remove the carousel (or the grid itself) from the ContentPage.Content and re-apply after the rotation? I'm trying but with no success, for now.
Have you found any other solution or workaround?

Yap, sorry guys, working on a new fix. #9654

@rmarinho Sorry but this bug still reproduce on version 4.5.0.356.
I have added CarouselView into Grid and it's not resize when orientation changed.
Please check again.

I'm having this problem as well in iOS. It seems that setting the CarouselView as the ContentPage.Content is the only scenario that I have been able to find that actually enables the CarouselView to correctly adjust when rotation occurs.

@phuccut and @nate123456 can you try 4.6.0.379-pre1

It didn't hit the 4.5.0 stabel version, but will be in the 4.5.0-sr1 that will push maybe today. But the 4.6.0 pre1 should have that fix.

I downloaded Xamarin.Forms.4.6.0.379-pre1 and tried my CarouselView setup and it does appear to be working much better. I did notice a few issues though.

When rotating on iOS, I noticed that, for a moment during the rotation, I could sometimes see a portion of the next item in the CarouselView. Perhaps this is just the expected experience on iOS and scrollable views.

I also noticed that when I rotated my iOS device, for a moment during the rotation, my CarouselView is not shown (I can see its parent grid), then the CarouselView reappears. It's almost as if the CarouselView is removed from the grid then added again. The end result is a sort of flashing effect when rotating. I can reduce how visually impactful it is by making the background of the grid a more similar color to the contents of the CarouselView, but it's not ideal. This does not occur with other elements on the page, only with the CarouselView. This issue did not occur on Android.

I made a bug report for that flashing issue here.

Was this page helpful?
0 / 5 - 0 ratings