Skip to content

Commit f24fef8

Browse files
committed
Update ShellSectionRenderer.cs
Update ShellSectionRenderer.cs
1 parent 6aef27e commit f24fef8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ void IAppearanceObserver.OnAppearanceChanged(ShellAppearance appearance)
7070
ShellSection _shellSection;
7171
bool _ignorePopCall;
7272

73+
bool _popRequested;
74+
7375
// When setting base.ViewControllers iOS doesn't modify the property right away.
7476
// if you set base.ViewControllers to a new array and then retrieve base.ViewControllers
7577
// iOS will return the previous array until the new array has been processed
@@ -107,7 +109,7 @@ public bool ShouldPopItem(UINavigationBar _, UINavigationItem __)
107109
[Export("navigationBar:didPopItem:")]
108110
[Internals.Preserve(Conditional = true)]
109111
bool DidPopItem(UINavigationBar _, UINavigationItem __)
110-
=> true;
112+
=> _popRequested || SendPop();
111113

112114
internal bool SendPop()
113115
{
@@ -392,6 +394,7 @@ protected virtual void OnNavigationRequested(object sender, NavigationRequestedE
392394

393395
protected virtual async void OnPopRequested(NavigationRequestedEventArgs e)
394396
{
397+
_popRequested = true;
395398
var page = e.Page;
396399
var animated = e.Animated;
397400

@@ -432,6 +435,7 @@ async void ProcessPopToRoot()
432435

433436
protected virtual async void OnPopToRootRequested(NavigationRequestedEventArgs e)
434437
{
438+
_popRequested = true;
435439
var animated = e.Animated;
436440
var task = new TaskCompletionSource<bool>();
437441
var pages = _shellSection.Stack.ToList();
@@ -593,6 +597,7 @@ public override UIViewController[] PopToViewController(UIViewController viewCont
593597
public override void PushViewController(UIViewController viewController, bool animated)
594598
{
595599
_pendingViewControllers = null;
600+
_popRequested = false;
596601
base.PushViewController(viewController, animated);
597602
}
598603

0 commit comments

Comments
 (0)