Skip to content

[BUG] Setting StatusBarBehavior breaks it on iOS in landscape mode #1707

Description

@RsZoli

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

When setting a ContentPage's StatusBarBehavior on a page like this:

<ContentPage.Behaviors>
    <toolkit:StatusBarBehavior StatusBarColor="{StaticResource Primary}" StatusBarStyle="LightContent" />
</ContentPage.Behaviors>

Navigating to another page and turn the phone to landscape mode, the result is this:

IMG_0002

However, after navigating to another page that has the StatusBarBehavior setting, there is no problem:

IMG_0003

Expected Behavior

The StatusBarBehaviour should be needed to set one time only, and have no issue after navigating from the page it has set on.

Steps To Reproduce

Please find it in my repository

Link to public reproduction project repository

https://github.com/RsZoli/GitHubRepros

Environment

- .NET MAUI CommunityToolkit: 7.0.1
- OS: iOS 16.7.5, iOS 17.3.1
- .NET MAUI: 8.0.6

Anything else?

No response

Activity

  1. bijington commented on Feb 23, 2024

    @bijington
    Contributor

    Debugging this in my head I suspect the SizeChanged event isn't firing from the page when the orientation changes. I wonder if that is a change in MAUI?

    @RsZoli Are you able to subscribe to the SizeChanged event in your page, change the orientation and see if it fires?

  2. RsZoli commented on Feb 23, 2024

    @RsZoli
    Author

    @bijington I have tried it, it does fire! On appearing and on orientation changing as well!

  3. bijington commented on Feb 25, 2024

    @bijington
    Contributor

    @RsZoli I have tested this issue as part of the PR here: #1471 and it appears to work. Interestingly I see a status bar in landscape mode though. What iPad are you testing on?

  4. RsZoli commented on Feb 25, 2024

    @RsZoli
    Author

    @bijington I'm testing only on iPhones.

  5. brendan-holly-modea commented on Apr 9, 2024

    @brendan-holly-modea

    Is this still an issue on version 8 of the community toolkit? I'm also seeing this behavior on .net7 with version 6.1 of this package, so it doesn't appear to be a new issue to version 7.0.1 of the package.

  6. randyburden commented on May 29, 2024

    @randyburden

    I am using version 9.0.0 of the CommunityToolkit.Maui package and am also experiencing this issue.

    My app is using MAUI Blazor Hybrid and once I change the status bar color on iOS, if I change to landscape mode, then I get the same reported behavior of where there is a colored rectangle at the top of the page that takes up about 45% of the width of the page. When the device rotates to a vertical orientation the issue goes away and when I rotate back to a horizontal orientation the issue appears again.

    Here is an example of how I'm changing the status bar:

    CommunityToolkit.Maui.Core.Platform.StatusBar.SetColor(Colors.Red);
    CommunityToolkit.Maui.Core.Platform.StatusBar.SetStyle(StatusBarStyle.LightContent);

    I was able fix the issue by subscribing to display info changes and calling StatusBar.UpdateBarSize like so:

    #if IOS
    DeviceDisplay.Current.MainDisplayInfoChanged += (sender, e) =>
    {
        CommunityToolkit.Maui.Core.Platform.StatusBar.UpdateBarSize();
    };
    #endif

    Some form of the above code should be incorporated into this library to fix the issue.

  7. thedee commented on Mar 20, 2025

    @thedee

    I am using version 9.0.0 of the CommunityToolkit.Maui package and am also experiencing this issue.

    My app is using MAUI Blazor Hybrid and once I change the status bar color on iOS, if I change to landscape mode, then I get the same reported behavior of where there is a colored rectangle at the top of the page that takes up about 45% of the width of the page. When the device rotates to a vertical orientation the issue goes away and when I rotate back to a horizontal orientation the issue appears again.

    Here is an example of how I'm changing the status bar:

    CommunityToolkit.Maui.Core.Platform.StatusBar.SetColor(Colors.Red);
    CommunityToolkit.Maui.Core.Platform.StatusBar.SetStyle(StatusBarStyle.LightContent);
    I was able fix the issue by subscribing to display info changes and calling StatusBar.UpdateBarSize like so:

    #if IOS
    DeviceDisplay.Current.MainDisplayInfoChanged += (sender, e) =>
    {
    CommunityToolkit.Maui.Core.Platform.StatusBar.UpdateBarSize();
    };
    #endif
    Some form of the above code should be incorporated into this library to fix the issue.

    This fixed the issue for me but UpdateBarSize is not an option. I had to use SetBarSize:
    CommunityToolkit.Maui.Core.Platform.StatusBar.SetBarSize(false);

    Similar reports:
    #1193

  8. iob-ubp commented on Dec 16, 2025

    @iob-ubp

    The issue is still present with net10.0-ios 26.1 :

    The workaround of @thedee is still working for me, thanks.

    Workload version: 10.0.100.1

    Installed Workload Id Manifest Version Installation Source

    maui-android 10.0.0/10.0.100 SDK 10.0.100
    maui-ios 10.0.0/10.0.100 SDK 10.0.100

  9. locked and limited conversation to collaborators on Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

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

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions