Skip to content

Commit 3d0469e

Browse files
SuthiYuvarajsheiksyedm
authored andcommitted
Fix for NavigationPage.TitleView does not expand with host window in iPadOS 26+ (#33088)
<!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Issue Description: On iPadOS 26+, NavigationPage.TitleView does not resize when the window dimensions change during device rotation, causing the TitleView to remain at its original width instead of expanding to fill the navigation bar. ### Root Cause iOS 26+ changed UIKit's layout behavior so that NavigationItem.TitleView container frames are no longer automatically updated during ViewWillTransitionToSize transitions, causing the TitleView to retain its original dimensions even when the navigation bar resizes. ### Description of Change Added explicit frame updates for the TitleView Container during view controller transitions on iOS 26+ by leveraging AnimateAlongsideTransition to synchronize the Container's frame with the navigation bar's dimensions, ensuring smooth resizing during rotation and window size changes. ### Issues Fixed Fixes #[32722 ](#32722) ### Tested the behaviour on the following platforms - [ ] Android - [ ] Windows - [x] iOS - [ ] Mac ### Note: This PR extends the behavior introduced in #32815 by adding support for the iPad scenario. As the earlier PR already provided the necessary test coverage, no new testcases are included in this follow‑up. ### Output Screenshot Before Issue Fix | After Issue Fix | |----------|----------| |<video width="300" height="150" alt="Before Fix" src="https://github.com/user-attachments/assets/22f2318e-0cbf-40e4-bbe6-0fb89d22b49f">|<video width="300" height="150" alt="After Fix" src="https://github.com/user-attachments/assets/492bac5f-447a-4c1d-9262-e0877053c1f5">|
1 parent 7f6db9c commit 3d0469e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/Controls/src/Core/Compatibility/Handlers/NavigationPage/iOS/NavigationRenderer.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1613,12 +1613,28 @@ UIImage GetEmptyBackIndicatorImage()
16131613
return empty;
16141614
}
16151615

1616+
/// <summary>
1617+
/// Called when the view controller's view transitions to a new size.
1618+
/// On iPad iOS 26+, manually updates TitleView frame to handle Stage Manager window resizing.
1619+
/// </summary>
16161620
public override void ViewWillTransitionToSize(SizeF toSize, IUIViewControllerTransitionCoordinator coordinator)
16171621
{
16181622
base.ViewWillTransitionToSize(toSize, coordinator);
16191623

16201624
if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
1625+
{
16211626
UpdateLeftBarButtonItem();
1627+
1628+
// For iOS 26+, force TitleView to re-layout on window size changes (iPad Stage Manager, multitasking)
1629+
// Complements TraitCollectionDidChange handling (device rotation) added in #32815
1630+
if (OperatingSystem.IsIOSVersionAtLeast(26) || OperatingSystem.IsMacCatalystVersionAtLeast(26))
1631+
{
1632+
coordinator.AnimateAlongsideTransition(_ =>
1633+
{
1634+
UpdateTitleViewFrameForOrientation();
1635+
}, null);
1636+
}
1637+
}
16221638
}
16231639

16241640
public override void TraitCollectionDidChange(UITraitCollection previousTraitCollection)

0 commit comments

Comments
 (0)