mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Fix broken navigation after clear history with transition
Resolves #1948
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
import * as application from "application";
|
||||
import {NavPage} from "../nav-page";
|
||||
import * as trace from "trace";
|
||||
import { Frame } from "ui/frame";
|
||||
|
||||
Frame.defaultTransition = { name: "fade" };
|
||||
|
||||
trace.enable();
|
||||
trace.setCategories(trace.categories.concat(
|
||||
trace.categories.NativeLifecycle,
|
||||
trace.categories.Navigation,
|
||||
//trace.categories.Animation,
|
||||
trace.categories.Transition
|
||||
));
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import definition = require("controls-page");
|
||||
import {View} from "ui/core/view";
|
||||
import {Page} from "ui/page";
|
||||
import {topmost as topmostFrame, NavigationTransition} from "ui/frame";
|
||||
import {topmost as topmostFrame, NavigationTransition, Frame} from "ui/frame";
|
||||
import {Orientation, AnimationCurve} from "ui/enums";
|
||||
import {StackLayout} from "ui/layouts/stack-layout";
|
||||
import {Button} from "ui/button";
|
||||
@@ -10,6 +10,7 @@ import {TextField} from "ui/text-field";
|
||||
import {Switch} from "ui/switch";
|
||||
import {Slider} from "ui/slider";
|
||||
import {Color} from "color";
|
||||
import {ScrollView} from "ui/scroll-view";
|
||||
import * as platform from "platform";
|
||||
|
||||
var availableTransitions = ["default", "custom", "flip", "flipRight", "flipLeft", "slide", "slideLeft", "slideRight", "slideTop", "slideBottom", "fade"];
|
||||
@@ -57,6 +58,10 @@ export class NavPage extends Page implements definition.ControlsPage {
|
||||
});
|
||||
that.on(Page.navigatedToEvent, (args) => {
|
||||
console.log(`${args.object}.navigatedToEvent`);
|
||||
(<any>topmostFrame())._printFrameBackStack();
|
||||
if (topmostFrame().android) {
|
||||
(<any>topmostFrame())._printNativeBackStack();
|
||||
}
|
||||
});
|
||||
|
||||
this.id = "" + context.index;
|
||||
@@ -122,6 +127,14 @@ export class NavPage extends Page implements definition.ControlsPage {
|
||||
animatedSwitch.checked = context.animated;
|
||||
optionsLayout.addChild(animatedSwitch);
|
||||
|
||||
var globalTransitionButton = new Button();
|
||||
globalTransitionButton.text = "global: " + (Frame.defaultTransition ? Frame.defaultTransition.name : "none");
|
||||
globalTransitionButton.on("tap", (args) => {
|
||||
Frame.defaultTransition = Frame.defaultTransition ? null : { name: "fade" };
|
||||
(<any>args.object).text = "global: " + (Frame.defaultTransition ? Frame.defaultTransition.name : "none");
|
||||
});
|
||||
optionsLayout.addChild(globalTransitionButton);
|
||||
|
||||
var transitionButton = new Button();
|
||||
transitionButton.text = availableTransitions[context.transition];
|
||||
transitionButton.on("tap", () => {
|
||||
@@ -202,6 +215,8 @@ export class NavPage extends Page implements definition.ControlsPage {
|
||||
});
|
||||
stackLayout.addChild(forwardButton);
|
||||
|
||||
this.content = stackLayout;
|
||||
var scrollView = new ScrollView();
|
||||
scrollView.content = stackLayout;
|
||||
this.content = scrollView;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user