Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS] CollectionView takes up huge vertical space #9135

Closed
BlagoCuljak opened this issue Aug 2, 2022 · 39 comments · Fixed by #14951
Closed

[iOS] CollectionView takes up huge vertical space #9135

BlagoCuljak opened this issue Aug 2, 2022 · 39 comments · Fixed by #14951
Assignees
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView fixed-in-7.0.96 Look for this fix in 7.0.96 SR8! fixed-in-7.0.100 fixed-in-7.0.101 fixed-in-8.0.0-preview.5.8529 Look for this fix in 8.0.0-preview.5.8529! p/0 Work that we can't release without partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with platform/iOS 🍎 t/bug Something isn't working

Comments

@BlagoCuljak
Copy link

Description

We are developing MAUI app, and we use CollectionView constantly. However, on iOS, every collection view takes up huge vertical space, just like this. Android looks good.
image

Here is the sample:
CollectionViewDemos.zip

Steps to Reproduce

Start the app, and click on one view in menu. Android looks fine, iPhone had huge problem with lower number of items in CollectionView.

Version with bug

6.0.408 (current)

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 15

Did you find any workaround?

None at the moment, you can set MaximumHeight, but it just gets ugly then, and not all items are displayed, and you need to scroll inside that small MaxHeight window.

Relevant log output

No response

@BlagoCuljak BlagoCuljak added s/needs-verification Indicates that this issue needs initial verification before further triage will happen t/bug Something isn't working labels Aug 2, 2022
@Eilon Eilon added the area-controls-collectionview CollectionView, CarouselView, IndicatorView label Aug 2, 2022
@jfversluis jfversluis changed the title [iOS] CollectionView takes up huge vertical space; this makes almost impossible to use MAUI [iOS] CollectionView takes up huge vertical space Aug 3, 2022
@jfversluis
Copy link
Member

Please add the repro as a GitHub repository, thank you!

@jfversluis jfversluis added s/needs-repro Attach a solution or code which reproduces the issue and removed s/needs-verification Indicates that this issue needs initial verification before further triage will happen labels Aug 3, 2022
@ghost
Copy link

ghost commented Aug 3, 2022

Hi @BlagoCuljak. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@BlagoCuljak
Copy link
Author

Please add the repro as a GitHub repository, thank you!

Hi @jfversluis, thanks for your comment, here you will find github repo.
https://github.com/BlagoCuljak/CollectionViewIOSheight

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-repro Attach a solution or code which reproduces the issue labels Aug 3, 2022
@jfversluis jfversluis removed the s/needs-attention Issue has more information and needs another look label Aug 4, 2022
@jfversluis jfversluis added this to the Backlog milestone Aug 4, 2022
@Adelzu
Copy link

Adelzu commented Aug 5, 2022

I can confirm the issue, present on iOS. Android works well.

@andrijankara
Copy link

Can confirm same issue on iOS, Android works OK!

@dhindrik
Copy link
Contributor

I can see the same problem in the horizontal direction. The screenshot is from a mac catalyst app.

Screenshot 2022-08-25 at 10 20 16

@mikeparker104 mikeparker104 added the partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with label Oct 14, 2022
@samhouts samhouts added the p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint label Oct 14, 2022
@ganeshachary
Copy link

Facing same issue with ios, works fine in Android - MAUI ios
My collection view is inside a Frame which is inside a ScrollView.
Any solution or workaround

@PureWeen
Copy link
Member

PureWeen commented Nov 2, 2022

Related #7315

@BaumTom
Copy link

BaumTom commented Nov 4, 2022

I'am also facing the same issue on MAUI for iOS. Is there any chance that this issue will be fixed in the near future?

@EmberLynn
Copy link

EmberLynn commented Nov 7, 2022

I am experiencing the exact same issue. I have nested collection views and each of them renders in a huge amount of space (only on iOS).

If anyone has any resources on how to possibly dynamically size the items and the CollectionView itself, I'd love to know because the current "built-in" functionality is completely broken.

@BaumTom
Copy link

BaumTom commented Nov 8, 2022

My workaround so far is to replace the CollectionView with a (Vertical)StackLayout with BindableLayout.ItemsSource. The CollectionView is not usable at all for me.

@BlagoCuljak

This comment was marked as off-topic.

@EmberLynn
Copy link

My workaround so far is to replace the CollectionView with a (Vertical)StackLayout with BindableLayout.ItemsSource. The CollectionView is not usable at all for me.

Thanks for the suggestion. I was also thinking about giving ListView a try, too.

@EmberLynn

This comment was marked as off-topic.

@akhanalcs

This comment was marked as off-topic.

@ThoHensler
Copy link

ThoHensler commented Mar 9, 2023

Same issue occurs with CarourselView. But I cannot find a similar workaround as above with tweaking MaximumHeightRequest in OnSizeChanged.

Code to reproduce:
Main ContentPage like this:

<VerticalStackLayout>
        <Label Text="Label1"></Label>
        <CarouselView ItemsSource="{Binding Items}" Loop="false" IndicatorView="indicatorView">
            <CarouselView.ItemTemplate>
                <DataTemplate>
                    <Label Text="{Binding Name}" BackgroundColor="LightGray"></Label>
                </DataTemplate>
            </CarouselView.ItemTemplate>
        </CarouselView>
        <IndicatorView x:Name="indicatorView" HorizontalOptions="Center"></IndicatorView>
        <Label Text="Label2"></Label>
    </VerticalStackLayout>
public partial class MainPage : ContentPage
{
    public class Item
    {
        public string Name { get; set; }
    }

    public ObservableCollection<Item> Items { set; get; }

    public MainPage()
	{
        Items = new ObservableCollection<Item>();
        Items.Add(new Item() { Name = "Item1" });
        Items.Add(new Item() { Name = "Item2" });
        Items.Add(new Item() { Name = "Item3" });
        InitializeComponent();
        BindingContext = this;
    }
}

@FM1973

This comment was marked as off-topic.

@GKG4

This comment was marked as off-topic.

@justcivah

This comment was marked as off-topic.

@Syed-RI
Copy link

Syed-RI commented May 18, 2023

+1 bumped into this one today. :( Same issue on iOS, Android works fine please send halp I just want to create app not fight basic layout issues

@imoulas
Copy link

imoulas commented May 18, 2023

same issue here .net 7

PureWeen pushed a commit that referenced this issue May 18, 2023
* Make CollectionView on iOS measure to content size
Fixes #9135

* Make tests work when device is in landscape

* Auto-format source code

* Removed extra local variable

* Update src/Controls/src/Core/Handlers/Items/ItemsViewHandler.iOS.cs

Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>

* Handle height/width invalidation checks independently

---------

Co-authored-by: GitHub Actions Autoformatter <autoformat@example.com>
Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>
@Syed-RI
Copy link

Syed-RI commented May 18, 2023

Hurray! When is the next release?

@jadenrogers
Copy link

Having ported the app from Xamarin the biggest bug bear has been related to Scrollable Views not sizing correctly and various work arounds. Fix above saved me #9135 (comment)
When is the next service release?

@Syed-RI
Copy link

Syed-RI commented May 18, 2023

I can confirm #9135 (comment) is a workaround till we have next release

@mwnovaprove
Copy link

It indeed is a workaround but it won't work if there's any other control that needs to be expanded below @Syed-RI

rmarinho pushed a commit that referenced this issue May 30, 2023
* Make CollectionView on iOS measure to content size
Fixes #9135

* Make tests work when device is in landscape

* Auto-format source code

* Removed extra local variable

* Update src/Controls/src/Core/Handlers/Items/ItemsViewHandler.iOS.cs

Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>

* Handle height/width invalidation checks independently

---------

Co-authored-by: GitHub Actions Autoformatter <autoformat@example.com>
Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>
hartez added a commit that referenced this issue Jun 14, 2023
* Make CollectionView on iOS measure to content size
Fixes #9135

* Make tests work when device is in landscape

* Auto-format source code

* Removed extra local variable

* Update src/Controls/src/Core/Handlers/Items/ItemsViewHandler.iOS.cs

Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>

* Handle height/width invalidation checks independently

---------

Co-authored-by: GitHub Actions Autoformatter <autoformat@example.com>
Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>
@ghost ghost locked as resolved and limited conversation to collaborators Jun 18, 2023
@samhouts samhouts added the fixed-in-8.0.0-preview.5.8529 Look for this fix in 8.0.0-preview.5.8529! label Jun 21, 2023
@samhouts samhouts modified the milestones: .NET 8 Planning, .NET 8 Aug 1, 2023
rmarinho pushed a commit that referenced this issue Aug 16, 2023
* Make CollectionView on iOS measure to content size (#14951)

* Make CollectionView on iOS measure to content size
Fixes #9135

* Make tests work when device is in landscape

* Auto-format source code

* Removed extra local variable

* Update src/Controls/src/Core/Handlers/Items/ItemsViewHandler.iOS.cs

Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>

* Handle height/width invalidation checks independently

---------

Co-authored-by: GitHub Actions Autoformatter <autoformat@example.com>
Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>

* Remove unused member

* Fix alignment check

---------

Co-authored-by: GitHub Actions Autoformatter <autoformat@example.com>
Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>
Co-authored-by: Javier Suárez <javiersuarezruiz@hotmail.com>
@samhouts samhouts added the fixed-in-7.0.96 Look for this fix in 7.0.96 SR8! label Oct 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView fixed-in-7.0.96 Look for this fix in 7.0.96 SR8! fixed-in-7.0.100 fixed-in-7.0.101 fixed-in-8.0.0-preview.5.8529 Look for this fix in 8.0.0-preview.5.8529! p/0 Work that we can't release without partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with platform/iOS 🍎 t/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.