Skip to content

[BUG] StatusBarBehavior does not occupy entire notch for modal pages when NavigationPage.HasNavigationBar="False" (iOS) #2287

@Axemasta

Description

@Axemasta

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

Crossposting this issue from Maui because I originally believed it to be a maui issue however with a little testing I've realized its an MCT issue.

Description

If you push a modal page (new NavigationPage(new FooPage())) and set NavigationPage.HasNavigationBar="False" there is a small top padding applied to the content page. This padding is not present when the navigation bar is being displayed.

Originally I thought this was an issue caused somewhere in prism (see #3064) however after upgrading to the latest maui controls & workloads version (8.0.91 controls, 8.0.82/8.0.400.2 workloads) I have noticed the issue got worse (the padding required has gone from 5px to 8px). I have been able to reproduce, in my reproduction the base page has no padding & the modal does:

Landing - non modal page
Screenshot 2024-09-27 at 17 29 58

Modal page, the thin like between the yellow & green should not be there
Screenshot 2024-09-27 at 17 30 23

Steps to Reproduce

  1. Navigate modally to a navigation page wrapped content page
  2. On the content page set NavigationPage.HasNavigationBar="False"
  3. Try and place content at the very top of the content page

Version with bug

8.0.91 SR9.1

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 16+

Did you find any workaround?

Set a negative top padding of -8px:

<ContentPage.Padding>
    <OnPlatform x:TypeArguments="Thickness">
        <!-- <On Platform="iOS" Value="0,-8,0,0" /> -->
    </OnPlatform>
</ContentPage.Padding>

Relevant log output

No response

Expected Behavior

Status bar is fully coloured in for any type of page

Steps To Reproduce

View sample app, see above as this issue has been crossposted from maui

Link to public reproduction project repository

https://github.com/Axemasta/NavigationBarPaddingRepro

Environment

  • .NET MAUI CommunityToolkit:
  • OS: iOS
  • .NET MAUI: 8.0.91 SR9.1 (All affected)

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/behaviorsIssue/Discussion/PR that has to do with BehaviorsbugSomething isn't workingunverified

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions