Skip to content

Commit 5b89900

Browse files
authored
[release/10.0.1xx-preview7] Update release with latest fixes from net10.0 (#30912) (#30998)
2 parents 0838a9b + e4d5bea commit 5b89900

File tree

52 files changed

+1750
-136
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1750
-136
lines changed

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

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -977,16 +977,27 @@ internal static void SetFlyoutLeftBarButton(UIViewController containerController
977977
{
978978
var icon = result?.Value;
979979
var originalImageSize = icon?.Size ?? CGSize.Empty;
980-
// Referred from the default hamburger size
981-
var defaultIconHeight = 23f;
982-
var defaultIconWidth = 23f;
980+
981+
// The largest height you can use for navigation bar icons in iOS.
982+
// Per Apple's Human Interface Guidelines, the navigation bar height is 44 points,
983+
// so using the full height ensures maximum visual clarity and maintains consistency
984+
// with iOS design standards. This allows icons to utilize the entire available
985+
// vertical space within the navigation bar container.
986+
var defaultIconHeight = 44f;
983987
var buffer = 0.1;
988+
// We only check height because the navigation bar constrains vertical space (44pt height),
989+
// but allows horizontal flexibility. Width can vary based on icon design and content,
990+
// while height must fit within the fixed navigation bar bounds to avoid clipping.
991+
984992
// if the image is bigger than the default available size, resize it
985993
if (icon is not null)
986994
{
987-
if (originalImageSize.Height - defaultIconHeight > buffer || originalImageSize.Width - defaultIconWidth > buffer)
995+
if (originalImageSize.Height - defaultIconHeight > buffer)
988996
{
989-
icon = icon.ResizeImageSource(defaultIconWidth, defaultIconHeight, originalImageSize);
997+
if (FlyoutPage.Flyout.IconImageSource is not FontImageSource fontImageSource || !fontImageSource.IsSet(FontImageSource.SizeProperty))
998+
{
999+
icon = icon.ResizeImageSource(originalImageSize.Width, defaultIconHeight, originalImageSize);
1000+
}
9901001
}
9911002
try
9921003
{

src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellPageRendererTracker.cs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -465,15 +465,26 @@ void UpdateLeftToolbarItems()
465465
{
466466
icon = result?.Value;
467467
var originalImageSize = icon?.Size ?? CGSize.Empty;
468-
// Referred from the default hamburger size
469-
var defaultIconHeight = 23f;
470-
var defaultIconWidth = 23f;
468+
469+
// The largest height you can use for navigation bar icons in iOS.
470+
// Per Apple's Human Interface Guidelines, the navigation bar height is 44 points,
471+
// so using the full height ensures maximum visual clarity and maintains consistency
472+
// with iOS design standards. This allows icons to utilize the entire available
473+
// vertical space within the navigation bar container.
474+
var defaultIconHeight = 44f;
471475
var buffer = 0.1;
476+
// We only check height because the navigation bar constrains vertical space (44pt height),
477+
// but allows horizontal flexibility. Width can vary based on icon design and content,
478+
// while height must fit within the fixed navigation bar bounds to avoid clipping.
479+
472480
// if the image is bigger than the default available size, resize it
473481

474-
if (icon is not null && originalImageSize.Height - defaultIconHeight > buffer || originalImageSize.Width - defaultIconWidth > buffer)
482+
if (icon is not null && originalImageSize.Height - defaultIconHeight > buffer)
475483
{
476-
icon = icon.ResizeImageSource(defaultIconWidth, defaultIconHeight, originalImageSize);
484+
if (image is not FontImageSource fontImageSource || !fontImageSource.IsSet(FontImageSource.SizeProperty))
485+
{
486+
icon = icon.ResizeImageSource(originalImageSize.Width, defaultIconHeight, originalImageSize);
487+
}
477488
}
478489
}
479490
else if (String.IsNullOrWhiteSpace(text) && IsRootPage && _flyoutBehavior == FlyoutBehavior.Flyout)

src/Controls/src/Core/FlyoutPage/FlyoutPage.cs

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,24 +53,44 @@ public Page Detail
5353
throw new InvalidOperationException("Detail must not already have a parent.");
5454

5555
var previousDetail = _detail;
56-
// TODO MAUI refine this to fire earlier
57-
_detail?.SendNavigatingFrom(new NavigatingFromEventArgs());
5856

57+
// Get the actual pages for navigation events (unwrap NavigationPages)
58+
var destinationPage =
59+
value is NavigationPage destinationNavPage ? destinationNavPage.CurrentPage : value;
60+
var previousPage = previousDetail is NavigationPage previousNavPage
61+
? previousNavPage.CurrentPage
62+
: previousDetail;
63+
64+
// Send NavigatingFrom event to the previous detail (if any)
65+
if (previousDetail is not null)
66+
{
67+
previousDetail.SendNavigatingFrom(new NavigatingFromEventArgs(destinationPage,
68+
NavigationType.Replace));
69+
}
70+
71+
// Update the detail property
5972
OnPropertyChanging();
60-
if (_detail != null)
73+
if (_detail is not null)
6174
InternalChildren.Remove(_detail);
6275
_detail = value;
6376
InternalChildren.Add(_detail);
6477
OnPropertyChanged();
6578

66-
if (this.HasAppeared)
79+
// Handle Appearing/Disappearing events if the FlyoutPage has appeared
80+
if (HasAppeared)
6781
{
6882
previousDetail?.SendDisappearing();
6983
_detail?.SendAppearing();
7084
}
7185

72-
previousDetail?.SendNavigatedFrom(new NavigatedFromEventArgs(_detail, NavigationType.PageSwap));
73-
_detail?.SendNavigatedTo(new NavigatedToEventArgs(previousDetail));
86+
// Send NavigatedFrom and NavigatedTo events
87+
if (previousDetail is not null)
88+
{
89+
previousDetail.SendNavigatedFrom(
90+
new NavigatedFromEventArgs(destinationPage, NavigationType.Replace));
91+
}
92+
93+
_detail.SendNavigatedTo(new NavigatedToEventArgs(previousPage, NavigationType.Replace));
7494
}
7595
}
7696

@@ -108,8 +128,9 @@ public Page Flyout
108128

109129
// TODO MAUI refine this to fire earlier
110130
var previousFlyout = _flyout;
131+
111132
// TODO MAUI refine this to fire earlier
112-
_flyout?.SendNavigatingFrom(new NavigatingFromEventArgs());
133+
previousFlyout?.SendNavigatingFrom(new NavigatingFromEventArgs(value, NavigationType.Replace));
113134

114135
OnPropertyChanging();
115136
if (_flyout != null)
@@ -123,9 +144,9 @@ public Page Flyout
123144
previousFlyout?.SendDisappearing();
124145
_flyout?.SendAppearing();
125146
}
126-
127-
previousFlyout?.SendNavigatedFrom(new NavigatedFromEventArgs(_flyout, NavigationType.PageSwap));
128-
_flyout?.SendNavigatedTo(new NavigatedToEventArgs(previousFlyout));
147+
148+
previousFlyout?.SendNavigatedFrom(new NavigatedFromEventArgs(_flyout, NavigationType.Replace));
149+
_flyout?.SendNavigatedTo(new NavigatedToEventArgs(previousFlyout, NavigationType.Replace));
129150
}
130151
}
131152

src/Controls/src/Core/MultiPage.cs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,15 @@ public T CurrentPage
8383

8484
var previousPage = _current;
8585
OnPropertyChanging();
86-
86+
8787
// TODO: MAUI refine this to fire earlier
88-
_current?.SendNavigatingFrom(new NavigatingFromEventArgs());
89-
88+
89+
// Send NavigatingFrom to the previous page or to the new page if no previous page exists
90+
if (_current is not null)
91+
{
92+
_current.SendNavigatingFrom(new NavigatingFromEventArgs(value, NavigationType.Replace));
93+
}
94+
9095
_current = value;
9196

9297
previousPage?.SendDisappearing();
@@ -96,9 +101,10 @@ public T CurrentPage
96101

97102
if (HasAppeared)
98103
_current?.SendAppearing();
99-
100-
previousPage?.SendNavigatedFrom(new NavigatedFromEventArgs(_current, NavigationType.PageSwap));
101-
_current?.SendNavigatedTo(new NavigatedToEventArgs(previousPage));
104+
105+
106+
previousPage?.SendNavigatedFrom(new NavigatedFromEventArgs(_current, NavigationType.Replace));
107+
_current?.SendNavigatedTo(new NavigatedToEventArgs(previousPage, NavigationType.Replace));
102108
}
103109
}
104110

@@ -377,4 +383,4 @@ void UpdateCurrentPage()
377383
CurrentPage = (T)SelectedItem;
378384
}
379385
}
380-
}
386+
}

src/Controls/src/Core/NavigationModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public Page PopModal()
113113
_navTree[0].Count > 0 &&
114114
_navTree[0][0] is not Shell)
115115
{
116-
previousPage.SendNavigatingFrom(new NavigatingFromEventArgs());
116+
previousPage.SendNavigatingFrom(new NavigatingFromEventArgs(CurrentPage, NavigationType.Pop));
117117
previousPage.SendDisappearing();
118118
CurrentPage.SendAppearing();
119119
}
@@ -201,7 +201,7 @@ public void PushModal(Page page)
201201
_navTree[0].Count > 0 &&
202202
_navTree[0][0] is not Shell)
203203
{
204-
previousPage.SendNavigatingFrom(new NavigatingFromEventArgs());
204+
previousPage.SendNavigatingFrom(new NavigatingFromEventArgs(page, NavigationType.Push));
205205
previousPage.SendDisappearing();
206206
page.SendAppearing();
207207
}

src/Controls/src/Core/NavigationPage/NavigationPage.Legacy.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ async Task<Page> PopAsyncInner(
2525

2626
var page = (Page)InternalChildren.Last();
2727
var previousPage = CurrentPage;
28-
SendNavigating();
28+
SendNavigating(NavigationType.Pop, previousPage);
2929
var removedPage = await RemoveAsyncInner(page, animated, fast);
3030
SendNavigated(previousPage, NavigationType.Pop);
3131
return removedPage;
@@ -150,7 +150,7 @@ async Task PopToRootAsyncInner(bool animated)
150150
return;
151151

152152
var previousPage = CurrentPage;
153-
SendNavigating();
153+
SendNavigating(NavigationType.PopToRoot, previousPage);
154154
FireDisappearing(CurrentPage);
155155
FireAppearing((Page)InternalChildren[0]);
156156

@@ -183,7 +183,9 @@ async Task PushAsyncInner(Page page, bool animated)
183183
return;
184184

185185
var previousPage = CurrentPage;
186-
SendNavigating();
186+
var navigationType = DetermineNavigationType();
187+
188+
SendNavigating(navigationType, previousPage);
187189
FireDisappearing(CurrentPage);
188190
FireAppearing(page);
189191

@@ -198,9 +200,9 @@ async Task PushAsyncInner(Page page, bool animated)
198200

199201
if (args.Task != null)
200202
await args.Task;
201-
}
202-
203-
SendNavigated(previousPage, NavigationType.Push);
203+
}
204+
205+
SendNavigated(previousPage, navigationType);
204206
Pushed?.Invoke(this, args);
205207
}
206208

0 commit comments

Comments
 (0)