-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Comments
Please add the repro as a GitHub repository, thank you! |
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. |
Hi @jfversluis, thanks for your comment, here you will find github repo. |
I can confirm the issue, present on iOS. Android works well. |
Can confirm same issue on iOS, Android works OK! |
Facing same issue with ios, works fine in Android - MAUI ios |
Related #7315 |
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? |
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. |
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. |
This comment was marked as off-topic.
This comment was marked as off-topic.
Thanks for the suggestion. I was also thinking about giving ListView a try, too. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Same issue occurs with CarourselView. But I cannot find a similar workaround as above with tweaking MaximumHeightRequest in OnSizeChanged. Code to reproduce: <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;
}
} |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
+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 |
same issue here .net 7 |
* 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>
Hurray! When is the next release? |
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) |
I can confirm #9135 (comment) is a workaround till we have next release |
It indeed is a workaround but it won't work if there's any other control that needs to be expanded below @Syed-RI |
* 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>
* 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>
* 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>
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.
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
The text was updated successfully, but these errors were encountered: