Skip to content

[iOS 26] Fix NavigationPage.TitleView not resizing on rotation#44

Closed
Copilot wants to merge 1 commit intomainfrom
copilot/fix-image-loading-issues
Closed

[iOS 26] Fix NavigationPage.TitleView not resizing on rotation#44
Copilot wants to merge 1 commit intomainfrom
copilot/fix-image-loading-issues

Conversation

Copy link
Copy Markdown

Copilot AI commented Nov 23, 2025

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 of Change

On iOS 26+ and MacCatalyst 26+, NavigationPage.TitleView fails to resize when device orientation changes. The view retains its initial width instead of expanding/contracting to fill the navigation bar.

Root cause: iOS 26 changed autoresizing behavior. While UIViewAutoresizing.FlexibleWidth handles width adjustments, the frame must be explicitly updated during trait collection changes to use the full navigation bar width.

Fix:

  • Override TraitCollectionDidChange in NavigationRenderer.PageContainer to detect orientation changes (size class transitions)
  • Explicitly update TitleView frame to match navigation bar dimensions on iOS 26+/MacCatalyst 26+
  • Only applies to iOS 26+ where the regression exists

Code change:

public override void TraitCollectionDidChange(UITraitCollection previousTraitCollection)
{
    base.TraitCollectionDidChange(previousTraitCollection);
    
    if (previousTraitCollection?.VerticalSizeClass != TraitCollection.VerticalSizeClass ||
        previousTraitCollection?.HorizontalSizeClass != TraitCollection.HorizontalSizeClass)
    {
        if (OperatingSystem.IsIOSVersionAtLeast(26) || OperatingSystem.IsMacCatalystVersionAtLeast(26))
        {
            UpdateTitleViewFrameForOrientation();
        }
    }
}

Issues Fixed

Fixes dotnet#32722

Original prompt

please review dotnet#32815

Custom agent used: pr-reviewer
Specialized agent for conducting thorough, constructive code reviews of .NET MAUI pull requests


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Fix image loading issues in MAUI [iOS 26] Fix NavigationPage.TitleView not resizing on rotation Nov 23, 2025
Copilot AI requested a review from kubaflo November 23, 2025 18:52
@kubaflo
Copy link
Copy Markdown
Owner

kubaflo commented Nov 23, 2025

@copilot I've tested and it passes my manual testing

@kubaflo
Copy link
Copy Markdown
Owner

kubaflo commented Nov 23, 2025

@copilot Can you create the review file?

Copy link
Copy Markdown
Author

Copilot AI commented Nov 23, 2025

@copilot Can you create the review file?

Code review completed. Found 3 items for consideration:

  1. NavigationRenderer.cs (line 1613-1616): Comment formatting - missing period after "FlexibleWidth"
  2. Issue32722.cs (lines 28, 46): Using Thread.Sleep in tests can be brittle. Consider async/await with Task.Delay or waiting for specific UI states

Overall, the fix is well-targeted and addresses the iOS 26+ regression appropriately by:

  • ✅ Only applying the fix to iOS/MacCatalyst 26+
  • ✅ Detecting orientation changes via trait collection
  • ✅ Explicitly updating TitleView frame to match navigation bar
  • ✅ Including comprehensive UI test coverage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NavigationPage.TitleView does not expand with host window in iPadOS 26+

2 participants