diff --git a/nativescript-core/ui/page/page.ios.ts b/nativescript-core/ui/page/page.ios.ts index 38c8224706..f921b8967a 100644 --- a/nativescript-core/ui/page/page.ios.ts +++ b/nativescript-core/ui/page/page.ios.ts @@ -124,6 +124,13 @@ class UIViewControllerImpl extends UIViewController { // Pages in backstack are unloaded so raise loaded here. if (!owner.isLoaded) { owner.callLoaded(); + } else { + // Note: Handle the case of canceled backstack navigation. (https://github.com/NativeScript/NativeScript/issues/7430) + // In this case viewWillAppear will be executed for the previous page and it will change the ActionBar + // because changes happen in an interactive transition - IOS will animate between the the states. + // If canceled - viewWillAppear will be called for the current page(which is already loaded) and we need to + // update the action bar explicitly, so that it is not left styles as the previous page. + owner.actionBar.update(); } } @@ -192,7 +199,7 @@ class UIViewControllerImpl extends UIViewController { if (!owner) { return; } - + // Cache presentedViewController if any. We don't want to raise // navigation events in case of presenting view controller. if (!owner._presentedViewController) { @@ -223,7 +230,7 @@ class UIViewControllerImpl extends UIViewController { if (!page || page.modal || page._presentedViewController) { return; } - + // Forward navigation does not remove page from frame so we raise unloaded manually. if (page.isLoaded) { page.callUnloaded();