dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.16k stars 1.74k forks source link

[iOS/Catalyst] CollectionView Item height of 0 collapses view. #16396

Open drasticactions opened 1 year ago

drasticactions commented 1 year ago

Description

If you have a CollectionView with an item within it with a height of 0, the rest of the items no longer render, breaking the view.

I have a list of boxes that grow in size in my reproduction sample. The first item starts with 0. It works on Android and Windows, but on iOS and Catalyst, it fails to render unless the item has at least a height of 1.

While my example is extreme, I think it can happen in practice. If you have a collectionview template without a defined height, you could hit this issue. For example, if you have an image that loads dynamically. If no images load before the view loads, the effective height is zero, which would break the view.

e. I also checked against net8 preview 6, and it's broken there as well, same issue.

Steps to Reproduce

  1. Run the reproduction sample, make sure that CollectionIncreaseBoxSizePage is the page set to run at startup.

You should see:

スクリーンショット 2023-07-27 17 18 17

But you'll actually see.

スクリーンショット 2023-07-27 17 16 17

Link to public reproduction project repository

https://github.com/drasticactions/UIBenchmarks/commit/d0cffc2363cb853da8ae9f3985174a2d33a79a90

Version with bug

7.0.49

Last version that worked well

Unknown/Other

Affected platforms

iOS, macOS

Affected platform versions

Current versions of iOS/Catalyst.

Did you find any workaround?

Make sure that the DataTemplate within the CollectionView has at least a height of 1. You can do this by setting whatever the container is to have MinimumHeightRequest="1"

Relevant log output

No response

ghost commented 1 year ago

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

Zhanglirong-Winnie commented 8 months ago

Verified this issue with Visual Studio 17.6.9 (build 415). Can repro on macOS platform with sample project. Windows machine works fine. https://github.com/drasticactions/UIBenchmarks image image