Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/Controls/src/Core/NavigationPage/NavigationPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public partial class NavigationPage : Page, IPageContainer<Page>, IBarElement, I

INavigationPageController NavigationPageController => this;


partial void Init();

#if WINDOWS || ANDROID || TIZEN
Expand All @@ -64,7 +64,7 @@ public partial class NavigationPage : Page, IPageContainer<Page>, IBarElement, I
#endif

bool _setForMaui;

/// <include file="../../docs/Microsoft.Maui.Controls/NavigationPage.xml" path="//Member[@MemberName='.ctor'][1]/Docs/*" />
public NavigationPage() : this(UseMauiHandler)
{
Expand Down Expand Up @@ -714,9 +714,9 @@ private protected override void OnHandlerChangedCore()
var visiblePage = Navigation.NavigationStack[NavigationStack.Count - 1];
RootPage = navStack[0];
CurrentPage = visiblePage;

var navigationType = DetermineNavigationType();

SendHandlerUpdateAsync(false, null,
() =>
{
Expand All @@ -736,21 +736,21 @@ private protected override void OnHandlerChangedCore()
((IStackNavigation)this).NavigationFinished(this.NavigationStack);
}
}

NavigationType DetermineNavigationType()
{
var parentPages = this.GetParentPages();

bool hasTabOrFlyout = parentPages.Any(page => page is FlyoutPage or TabbedPage);

if (hasTabOrFlyout)
{
return NavigationType.Replace;
}

return NavigationType.Push;
}

// Once we get all platforms over to the new APIs
// we can just delete all the code inside NavigationPage.cs that fires "requested" events
class MauiNavigationImpl : NavigationProxy
Expand Down Expand Up @@ -894,7 +894,7 @@ protected override Task OnPushAsync(Page root, bool animated)
Owner.NavigationType = navigationType;
// Move the SendNavigating here so that it's fired prior to the stack being modified
// This ensures consistent event ordering across all platforms (iOS, Catalyst, Android, Windows)
Owner.SendNavigating(previousPage);
Owner.SendNavigating(navigationType, previousPage);
Owner.PushPage(root);
},
() =>
Expand Down