Skip to content

Commit 6133d6b

Browse files
Alexander Vakrilovvtrifonovdtopuzov
committed
fix(ios): ActionBar style wrong after cancelled swipe back navigation (#8252)
* fix(ios): ActionBar style wrong after cancelled swipe back navigation * chore: cleanup * remove unneeded console.log Co-authored-by: Vasil Trifonov <v.trifonov@gmail.com> Co-authored-by: Dimitar Topuzov <dtopuzov@gmail.com>
1 parent d90f37a commit 6133d6b

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

nativescript-core/ui/page/page.ios.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,13 @@ class UIViewControllerImpl extends UIViewController {
124124
// Pages in backstack are unloaded so raise loaded here.
125125
if (!owner.isLoaded) {
126126
owner.callLoaded();
127+
} else {
128+
// Note: Handle the case of canceled backstack navigation. (https://github.com/NativeScript/NativeScript/issues/7430)
129+
// In this case viewWillAppear will be executed for the previous page and it will change the ActionBar
130+
// because changes happen in an interactive transition - IOS will animate between the the states.
131+
// If canceled - viewWillAppear will be called for the current page(which is already loaded) and we need to
132+
// update the action bar explicitly, so that it is not left styles as the previous page.
133+
owner.actionBar.update();
127134
}
128135
}
129136

@@ -192,7 +199,7 @@ class UIViewControllerImpl extends UIViewController {
192199
if (!owner) {
193200
return;
194201
}
195-
202+
196203
// Cache presentedViewController if any. We don't want to raise
197204
// navigation events in case of presenting view controller.
198205
if (!owner._presentedViewController) {
@@ -223,7 +230,7 @@ class UIViewControllerImpl extends UIViewController {
223230
if (!page || page.modal || page._presentedViewController) {
224231
return;
225232
}
226-
233+
227234
// Forward navigation does not remove page from frame so we raise unloaded manually.
228235
if (page.isLoaded) {
229236
page.callUnloaded();

0 commit comments

Comments
 (0)