[release/11.0.1xx-preview7] Forward status bar style through NavigationPage handler - #37047
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9be49656-7117-4235-9d96-404779ab6b16
|
/azp run |
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 37047Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 37047" |
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
This PR fixes an iOS behavior regression in the new NavigationViewHandler stack by ensuring UIKit can resolve PreferredStatusBarStyle from the current page’s view controller (via the same navigation-controller / parenting-controller forwarding that already exists for status-bar hidden queries).
Changes:
- Forward
ChildViewControllerForStatusBarStyle()from the internalMauiNavigationControllerto the current top view controller (iOS-only). - Forward
ChildViewControllerForStatusBarStyle()from the NavigationView handler’s parenting controller down to the child handler’sViewController(iOS-only).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Core/src/Platform/iOS/NavigationControllerManager/NavigationControllerManager.cs | Adds iOS-only forwarding for ChildViewControllerForStatusBarStyle() so UINavigationController status bar style queries reach the active page controller. |
| src/Controls/src/Core/Platform/iOS/NavigationViewHandlerToolbarHelper.cs | Adds iOS-only forwarding for ChildViewControllerForStatusBarStyle() from the parenting controller to the child handler’s view controller. |
|
Independent verification found the same root cause and fix shape before comparing this PR:
Local focused evidence on an iOS 26.5 simulator (
This matches the Preview 7 CI signature and confirms the existing test catches the product regression. One minor lifecycle note: the parenting-controller override here falls back to |
Return base.ChildViewControllerForStatusBarStyle() when no child handler view controller is available, matching the sibling override in the wrapped controller and avoiding a potential status-bar-style delegation cycle from returning `this`. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d00747b7-96f3-4e7a-8dfb-e3a48db04b2d
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Suppressed comments (2)
src/Core/src/Platform/iOS/NavigationControllerManager/NavigationControllerManager.cs:242
- Avoid null-forgiving on base.ChildViewControllerForStatusBarStyle(). Since the base implementation can legally return null, prefer an explicit fallback (e.g.,
?? this) so this override never returns null and the behavior is clear under nullable reference types.
return vc;
}
return base.ChildViewControllerForStatusBarStyle()!;
}
src/Controls/src/Core/Platform/iOS/NavigationViewHandlerToolbarHelper.cs:118
- Avoid using null-forgiving on base.ChildViewControllerForStatusBarStyle(). The UIKit override is allowed to return null, but this method is declared non-nullable here; returning the base value with
!can mask a null return and makes the intent unclear. Prefer returningthiswhen there is no child VC, matching the existing StatusBarHidden implementation.
#if !MACCATALYST
public override UIViewController ChildViewControllerForStatusBarStyle() =>
(Child?.Handler as IPlatformViewHandler)?.ViewController ?? base.ChildViewControllerForStatusBarStyle()!;
|
Follow-up after forcing the runner onto the exact iOS 18.5 simulator ( So the available local matrix is now:
Correction to my earlier fallback note: after a second lifecycle review, One runner quirk: |
|
CI follow-up for
The relevant shipping matrices are therefore green in CI on the original fix commit, consistent with the focused local iOS 18.5 and 26.5 runs. Requesting a fresh device run below because the PR head changed afterward (fallback-only adjustment). |
|
/azp run maui-pr-devicetests |
|
@PureWeen thanks for the review. Applied the suggestion in 838e913 — |
|
/azp run maui-pr-devicetests |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
1 similar comment
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
@PureWeen current head
The separate Mono build failure is the unrelated Graphics |
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Description
The new iOS
NavigationViewHandlerforwards status-bar hidden queries through its navigation-controller and parenting-controller layers, but does not forward status-bar style queries. UIKit therefore resolvesPreferredStatusBarStyleon the navigation controller and returnsDefaultinstead of the current page style.Forward
ChildViewControllerForStatusBarStylethrough both handler layers, matching the oldNavigationRendererbehavior. The existingStatusBarThemeFlowsThroughRootController(NavigationPage)device test covers the regression.Failure evidence
Device build 1537360 failed the same test on all four iOS Mono/CoreCLR and Xcode queue combinations. Other root page types passed.