Going back with the stock "Back" button on iOS will now respect the animated setting used when coming to the current page

Fixes #1787
This commit is contained in:
Rossen Hristov
2016-03-17 17:08:39 +02:00
parent 09304b4345
commit 6de1afc2a9

View File

@ -70,10 +70,16 @@ export class Frame extends frameCommon.Frame {
navDepth++;
var animated = this.currentPage ? this._getIsAnimatedNavigation(backstackEntry.entry) : false;
if (animated) {
var navigationTransition = this._getNavigationTransition(backstackEntry.entry);
if (animated && navigationTransition) {
if (navigationTransition) {
viewController[TRANSITION] = navigationTransition;
}
}
else {
//https://github.com/NativeScript/NativeScript/issues/1787
viewController[TRANSITION] = { name: "non-animated" };
}
backstackEntry[NAV_DEPTH] = navDepth;
viewController[ENTRY] = backstackEntry;
@ -551,6 +557,11 @@ class UINavigationControllerImpl extends UINavigationController implements UINav
return super.popViewControllerAnimated(animated);
}
if (navigationTransition.name === "non-animated") {
//https://github.com/NativeScript/NativeScript/issues/1787
return super.popViewControllerAnimated(false);
}
var nativeTransition = _getNativeTransition(navigationTransition, false);
if (!nativeTransition) {
return super.popViewControllerAnimated(animated);
@ -579,6 +590,11 @@ class UINavigationControllerImpl extends UINavigationController implements UINav
return super.popToViewControllerAnimated(viewController, animated);
}
if (navigationTransition.name === "non-animated") {
//https://github.com/NativeScript/NativeScript/issues/1787
return super.popToViewControllerAnimated(viewController, false);
}
var nativeTransition = _getNativeTransition(navigationTransition, false);
if (!nativeTransition) {
return super.popToViewControllerAnimated(viewController, animated);