CollectionView not sized correctly on iOS #11070
Labels
area-controls-collectionview
CollectionView, CarouselView, IndicatorView
area-layout
StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter
p/0
Work that we can't release without
platform/iOS 🍎
t/bug
Something isn't working
Milestone
Description
CollectionView is not sizing itself correctly on iOS and is expanding beyond the height of the screen, regardless of the content size.
As in the attached sample, I have a collection of 5 strings on my viewmodel which I've bound to a collection view that is wrapped by a vertical stack. On Android, the collection view only takes up as much space on screen as it needs to in order to display the content.
On iOS the collection view takes up the whole screen. If you wrap it in a scrollview you can see it actually extends beyond a full screen's height. This becomes a problem for all content below the collection view like buttons or labels as they are then pushed far down or off the screen on iOS, but display correctly on Android
Android:
iOS:
Steps to Reproduce
Create a new maui app.
Replace the mainpage content inside the VerticalStackLayout with a collection view, bound to a few items.
Link to public reproduction project repository
https://dev.azure.com/gooseza/MauiBugs/_git/MauiBugs.CollectionView
Version with bug
6.0.486 (current)
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
iOS 16.0.3
Did you find any workaround?
No.
You can set a heightrequest but this defeats the purpose because you won't always know how many items your datasource will have and then items will get cut off.
Relevant log output
No response
The text was updated successfully, but these errors were encountered: