Xamarin.forms: [Bug] [iOS] CollectionView incorrectly performs layout on iOS

Created on 30 Jul 2020  路  8Comments  路  Source: xamarin/Xamarin.Forms

Description

CollectionView shows incorrect gaps between items. The controls snap into the correct location when scrolling begins.

Steps to Reproduce

  1. Add a CollectionView with a template that contains margins and text that wraps
  2. View control

Expected Behavior

Controls are laid out correctly.

Actual Behavior

Incorrect spacing between items. The controls snap into the correct location when you start to scroll the view.

Basic Information

  • Version with issue:
  • Last known good version: None
  • IDE: VS2019
  • Nuget Packages: Xamarin.Forms 4.7.0.1179
  • Affected Devices: Tested with iPhone 6S

Screenshots


When the page is loaded:
IMG_0009

As soon as a scroll starts to happen:
IMG_0010

Reproduction Link


https://github.com/DuncWatts/CollectionViewRepro

Specifically: https://github.com/DuncWatts/CollectionViewRepro/blob/master/CollectionViewRepro/CollectionViewRepro/MainPage.xaml

Workaround

None

collectionview iOS 馃崕 bug

Most helpful comment

@AntonIOIOIO agreed. No idea why Xamarin can't stop putting extremely buggy controls into release. Total lack of discipline in the team as far as I can tell.

All 8 comments

This happens when views have different heights inside the collectionview. This is not ok as we have a duplicate issue #7699 that is almost a year old. The collectionview should be in preview until this is fixed. New people are gonna use the collectionview and run into this bug and be really confused. @samhouts @davidortinau @jamesmontemagno

This happens when views have different heights inside the collectionview. This is not ok as we have a duplicate issue #7699 that is almost a year old. The collectionview should be in preview until this is fixed. New people are gonna use the collectionview and run into this bug and be really confused. @samhouts @davidortinau @jamesmontemagno

I have given up on the collection view and only use BindableLayouts with a scroll view. It seems to be the most consistent way of drawing content of arbitrary size that works for the most part.

@AntonIOIOIO agreed. No idea why Xamarin can't stop putting extremely buggy controls into release. Total lack of discipline in the team as far as I can tell.

Ah so it's a caching fault with multiple items sharing heights.

I've modified my example with a spacer that gives a random height between 0.0 and 0.1px for each item and that seems to be a workaround for now.

@DuncWatts what iOS version are you running on?

I tried on a few iPhone 6s's and I'm not seeing that first layout

image

@PureWeen I'm using a physical device running iOS 13.6

@duncanmak what device?

Ok got it to reproduce on the SE 2nd generation.

When the repo loads:
Simulator Screen Shot - iPhone SE (2nd generation) - 2020-08-12 at 11 10 54

If I try to scroll it fixes the issue
Simulator Screen Shot - iPhone SE (2nd generation) - 2020-08-12 at 11 10 59

Was this page helpful?
0 / 5 - 0 ratings