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

Setting NavigationPage.HasNavigationBar="False" on modally presented NavigationPage causes top padding on iOS #24972

Closed
Axemasta opened this issue Sep 27, 2024 · 6 comments
Labels
area-controls-modal area-navigation NavigationPage migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert platform/iOS 🍎 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@Axemasta
Copy link
Contributor

Axemasta commented Sep 27, 2024

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

Link to public reproduction project repository

https://github.com/Axemasta/NavigationBarPaddingRepro

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

@Axemasta Axemasta added the t/bug Something isn't working label Sep 27, 2024
@Axemasta
Copy link
Contributor Author

This issue is most likely the same root cause as #20418, however that issue closed without resolution and required prism whereas this issue reproduces the issue outside of prism!

@samhouts samhouts added platform/iOS 🍎 migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert area-navigation NavigationPage area-controls-modal labels Oct 1, 2024
@jaosnz-rep jaosnz-rep added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Oct 11, 2024
@jaosnz-rep
Copy link

I can repro it at iOS platform on the latest 17.11.5(8.0.91&8.0.90).
Image

@kubaflo
Copy link
Contributor

kubaflo commented Oct 13, 2024

Hi, @Axemasta in my opinion it is not a bug, the pages are correctly placed within their safe area

It looks more like a status bar issue which is not handled by MAUI, but by the Community toolkit

@jsuarezruiz jsuarezruiz added this to the Backlog milestone Oct 15, 2024
@Axemasta
Copy link
Contributor Author

Hi, @Axemasta in my opinion it is not a bug, the pages are correctly placed within their safe area

I think you are right, I've checked the sample without the behavior applied and it seems to layout fine. I'll raise it with the MCT team

@kubaflo
Copy link
Contributor

kubaflo commented Oct 30, 2024

@Axemasta here it is: CommunityToolkit/Maui#2309 :)

@Axemasta
Copy link
Contributor Author

Oh wow! you are a machine Jakob! 🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-modal area-navigation NavigationPage migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert platform/iOS 🍎 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants