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

[Bug] CollectionView (iOS) using horizontal grid does not display last column of uneven item count #6077

Closed
tetowill opened this issue May 2, 2019 · 6 comments

Comments

@tetowill
Copy link

tetowill commented May 2, 2019

Description

If you set CollectionView to a horizontal grid layout with multiple rows (span) and define a width for your items the last column gets dropped if it's not a full column. So if the last column doesn't have an item for each row it will not be displayed. If you set the CollectionView orientation to vertical this is not an issue, the last uneven row will be displayed.

I found that setting ItemSizingStrategy to MeasureFirstItem fixes this issue and the last column of uneven items will then show. Also, if you do not set a width for your items then the last uneven row will show.

I tested this in iOS and Android in Xamarin.Forms 4.0.0.346134-pre9 and only see this bug in iOS.

Steps to Reproduce

  1. Set up a CollectionView with Orientation set to Horizontal and Span set to more than 1.
  2. Set up the ItemTemplate and define a width for each item.
  3. Set the ItemsSource with a number of items that will give you an uneven final column. In the attached example project the Span is set to 3 and the ItemsSource is a collection of 14 items which leaves the final column at 2 items instead of 3 for a full column.

Expected Behavior

The last column of items with a set width in a CollectionView using a horizontal grid layout should display regardless of the number of items in that column.

Actual Behavior

The last column of items with a set width in a CollectionView using a horizontal grid layout does not display if the items to not full all the rows.

Basic Information

  • Version with issue: Xamarin.Forms 4.0.0.346134-pre9
  • Last known good version:
  • IDE: Visual Studio for Mac
  • Platform Target Frameworks:
    • iOS: 12.2
    • Android: 8.1.0
  • Android Support Library Version:
  • Nuget Packages: Xamarin.Forms 4.0.0.346134-pre9
  • Affected Devices: Tested on iOS Xr and 6s Simulator, and Android Nexus 6P

Screenshots

Reproduction Link

CollectionViewHorizontalGridBug.zip

@tetowill tetowill added s/unverified New report that has yet to be verified t/bug 🐛 labels May 2, 2019
@seansparkman
Copy link

I can confirm this issue as well.

@kingces95
Copy link
Contributor

kingces95 commented May 3, 2019

Hm. I can see the last column. Is this not the expected behavior?

Image from iOS

@kingces95 kingces95 added the s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. label May 3, 2019
@tetowill
Copy link
Author

tetowill commented May 3, 2019

@kingces95, seeing that last column is the expected behavior, but that photo looks like an Android device. I only noticed this bug on iOS. When I test on Android I also see the last column, but in the iOS simulator that last column does not display.

@seansparkman
Copy link

seansparkman commented May 3, 2019

2019-05-03_12-13-32-PM
This is the tetwill's sample app running as is on an iOS Remote Simulator. The Item 13 and 14 are missing.

@tetowill
Copy link
Author

tetowill commented May 3, 2019

Figured I may as well mention this again as well. The last column will show in iOS if you set ItemSizingStrategy to MeasureFirstItem, but when it's left to default or set to MeasureAllItems the last uneven column does not display.

@samhouts samhouts removed the s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. label May 3, 2019
@samhouts samhouts added e/5 🕔 5 and removed s/unverified New report that has yet to be verified labels May 8, 2019
hartez added a commit that referenced this issue May 21, 2019
…fixes #6077

Fix content inset behaviors when dealing with safe area on newer iOS versions
hartez added a commit that referenced this issue May 21, 2019
…fixes #6077

Fix content inset behaviors when dealing with safe area on newer iOS versions
hartez added a commit that referenced this issue Jun 4, 2019
…fixes #6077

Fix content inset behaviors when dealing with safe area on newer iOS versions
hartez added a commit that referenced this issue Jun 17, 2019
…fixes #6077

Fix content inset behaviors when dealing with safe area on newer iOS versions
@Jiang-Junjie
Copy link

Chaning to MeasureFirstItem, it works!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants