mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix(frame): push recreated frame back in frameStack when Don't Keep Activities enabled (#8096)
This commit is contained in:
committed by
GitHub
parent
786aca3039
commit
47f4c25a69
@@ -70,12 +70,12 @@ export class FrameBase extends CustomLayoutView implements FrameDefinition {
|
|||||||
const top = FrameBase.topmost();
|
const top = FrameBase.topmost();
|
||||||
if (top && top.canGoBack()) {
|
if (top && top.canGoBack()) {
|
||||||
top.goBack();
|
top.goBack();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else if (top) {
|
} else if (top) {
|
||||||
let parentFrameCanGoBack = false;
|
let parentFrameCanGoBack = false;
|
||||||
let parentFrame = <FrameBase>getAncestor(top, "Frame");
|
let parentFrame = <FrameBase>getAncestor(top, "Frame");
|
||||||
|
|
||||||
while (parentFrame && !parentFrameCanGoBack) {
|
while (parentFrame && !parentFrameCanGoBack) {
|
||||||
if (parentFrame && parentFrame.canGoBack()) {
|
if (parentFrame && parentFrame.canGoBack()) {
|
||||||
parentFrameCanGoBack = true;
|
parentFrameCanGoBack = true;
|
||||||
@@ -83,18 +83,18 @@ export class FrameBase extends CustomLayoutView implements FrameDefinition {
|
|||||||
parentFrame = <FrameBase>getAncestor(parentFrame, "Frame");
|
parentFrame = <FrameBase>getAncestor(parentFrame, "Frame");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parentFrame && parentFrameCanGoBack) {
|
if (parentFrame && parentFrameCanGoBack) {
|
||||||
parentFrame.goBack();
|
parentFrame.goBack();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frameStack.length > 1) {
|
if (frameStack.length > 1) {
|
||||||
top._popFromFrameStack();
|
top._popFromFrameStack();
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,11 +216,11 @@ export class FrameBase extends CustomLayoutView implements FrameDefinition {
|
|||||||
traceWrite(`NAVIGATE`, traceCategories.Navigation);
|
traceWrite(`NAVIGATE`, traceCategories.Navigation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._pushInFrameStack();
|
||||||
|
|
||||||
const entry = buildEntryFromArgs(param);
|
const entry = buildEntryFromArgs(param);
|
||||||
const page = Builder.createViewFromEntry(entry) as Page;
|
const page = Builder.createViewFromEntry(entry) as Page;
|
||||||
|
|
||||||
this._pushInFrameStack();
|
|
||||||
|
|
||||||
const backstackEntry: BackstackEntry = {
|
const backstackEntry: BackstackEntry = {
|
||||||
entry: entry,
|
entry: entry,
|
||||||
resolvedPage: page,
|
resolvedPage: page,
|
||||||
|
|||||||
@@ -483,6 +483,13 @@ export class Frame extends FrameBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public createNativeView() {
|
public createNativeView() {
|
||||||
|
// Create native view with available _currentEntry occur in Don't Keep Activities
|
||||||
|
// scenario when Activity is recreated on app suspend/resume. Push frame back in frame stack
|
||||||
|
// since it was removed in disposeNativeView() method.
|
||||||
|
if (this._currentEntry) {
|
||||||
|
this._pushInFrameStack();
|
||||||
|
}
|
||||||
|
|
||||||
return new org.nativescript.widgets.ContentLayout(this._context);
|
return new org.nativescript.widgets.ContentLayout(this._context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user