CommunityToolkit / Maui

The .NET MAUI Community Toolkit is a community-created library that contains .NET MAUI Extensions, Advanced UI/UX Controls, and Behaviors to help make your life as a .NET MAUI developer easier
https://learn.microsoft.com/dotnet/communitytoolkit/maui
MIT License
2.28k stars 403 forks source link

[iOS] StatusBarBehavior does not occupy entire notch - fix #2309

Open kubaflo opened 3 weeks ago

kubaflo commented 3 weeks ago

Description of Change

I've encountered this bug while working with MAUI: https://github.com/dotnet/maui/issues/24972 and it turns out that it is rather an issue that should be linked to this repository.

Basically the status bar is wrong for some screens. I've found this comments here: https://forums.developer.apple.com/forums/thread/662466

Screenshot 2024-10-30 at 19 33 40

It makes sense because when I based the status bar height on the top safe area I have the following result:

Expected Before After

Linked Issues

It might also fix this one: https://github.com/dotnet/maui/issues/25435, but I'm not 100% sure if it is a status bar's or MAUI's issue. Maybe even both

PR Checklist

brminnick commented 3 weeks ago

The StatusBar overlaps the navigation bar in the After photo.

To help visualize this, I've added a green bar in the photo below that is the same height as the NavigationBar. The green bar is the same height in both the Before and After image.

Screenshot 2024-10-30 at 11 56 09 AM
kubaflo commented 3 weeks ago

Please link to a bug (or open a new Issue) in our GitHub repo to help us understand + reproduce the problem you are trying to fix.

Please also update edit the title of this PR; Improve status bar does not explain the bug or the proposed solution.

Please ensure the status bar does not overlap the navigation bar

Screenshot 2024-10-30 at 11 56 09 AM

Yea, but it is the iOS's native behaviour. Generally status bar should have the same color as the navigation bar. The only point for customising it is when we don't have a navigation bar. And the current MCT solution would give the following outcome:

Screenshot 2024-10-30 at 20 09 22
Axemasta commented 3 weeks ago

Please link to a bug (or open a new Issue) in our GitHub repo to help us understand + reproduce the problem you are trying to fix.

This is the issue #2287, Originally I thought it was a maui issue but its not and actually a status bar behaviour issue, since the repro app doesn't apply the padding when not using the behavior

jfversluis commented 3 weeks ago

Another report of this bug: https://github.com/dotnet/maui/issues/25435

Additionally I also ran into this myself while working on the https://github.com/jfversluis/blazor-hybrid-workshop

kubaflo commented 4 days ago

Hi! Any update concerning this PR?

pictos commented 4 days ago

@brminnick what do you think about @kubaflo's answer?

brminnick commented 4 days ago

This is a tough one. Both the Community Toolkit and .NET MAUI are correctly using SafeAreaInserts. This appears to be how iOS has designed their operating system UI.

I've searched Apple's Human Interface Design Guidelines to learn more about their recommendations around the status bar and modality, but they don't provide any specific instructions.

Since this "bug" only seems to affect Modal Pages, my recommendation is to use PageSheet for modal all modal pages on iOS. I've provided the code here: https://github.com/CommunityToolkit/Maui/issues/2287#issuecomment-2448308553

My vote is to close both this PR and the Issue as this is the design that Apple is pushing us developers into.

brminnick commented 4 days ago

Hi! Any update concerning this PR?

To answer @kubaflo's question, we are blocked from merging any PRs until we are able to merge our .NET 9 PR which is currently blocked by a bug in .NET MAUI.

Once the MAUI engineering team resolves this bug, we will be unblocked and can resume merging PRs for the Community Toolkit: https://github.com/dotnet/maui/issues/25871

kubaflo commented 4 days ago

Okay, @brminnick do whatever you think is the best :) But I don't think it happens only on modal pages, it happens on pages without a navigation bar