Skip to content

iOS - CollectionView with varying row heights only gives one row of height per item until something triggers a refresh #23123

Open

Description

Description

I have a grouped CollectionView with simple labels as items. Some of these items can be multiple lines long via WordWrap. When I add items to a group, everything works perfectly on Android, but on iOS, the CollectionView only gives one row per item regardless of size, leading to overlapping or partially hidden items. The view only corrects itself when another group is added/removed OR when something triggers a UI refresh such as rotating the screen or scrolling the affected area out of and back into view. I have not found any way to manually trigger a UI recalculation after adding/removing items that properly recalculates. The Collection/Property Changed notifications make the items appear/disappear, but do not properly calculate the size of each item in the CollectionView.

Video screen capture of the issue:

MAUI.CollectionView.Bug.ScreenCap.mp4

Steps to Reproduce

  1. Launch the app on an iOS Simulator or Device
  2. Click Category 1 (note the overlapping items due to only having one row per item including two-line items)
  3. Click Category 2 (Category 1 refreshes and corrects itself - how can I force this back in step 2?)
  4. Click Category 3 (note the final two-line item is cut off as one one row of height was allocated)
  5. Click Category 2 again (Category 3 corrects itself)

Link to public reproduction project repository

https://github.com/mattkeene/CollectionViewRowHeightBugIOS

Version with bug

8.0.60 SR6

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 17

Did you find any workaround?

The only workaround I have found is to completely clear and reassign the CollectionView.ItemsSource before adding/removing items then reassigning it afterwards, which in effect kills the UI animations and makes the UI jumpy. Also, because it's a brand new list, it jumps to the top of the CollectionView, losing their place.

Relevant log output

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    area-controls-collectionviewCollectionView, CarouselView, IndicatorViewplatform/iOS 🍎s/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions