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();
|
||||
if (top && top.canGoBack()) {
|
||||
top.goBack();
|
||||
|
||||
|
||||
return true;
|
||||
} else if (top) {
|
||||
let parentFrameCanGoBack = false;
|
||||
let parentFrame = <FrameBase>getAncestor(top, "Frame");
|
||||
|
||||
|
||||
while (parentFrame && !parentFrameCanGoBack) {
|
||||
if (parentFrame && parentFrame.canGoBack()) {
|
||||
parentFrameCanGoBack = true;
|
||||
@@ -83,18 +83,18 @@ export class FrameBase extends CustomLayoutView implements FrameDefinition {
|
||||
parentFrame = <FrameBase>getAncestor(parentFrame, "Frame");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (parentFrame && parentFrameCanGoBack) {
|
||||
parentFrame.goBack();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (frameStack.length > 1) {
|
||||
top._popFromFrameStack();
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -216,11 +216,11 @@ export class FrameBase extends CustomLayoutView implements FrameDefinition {
|
||||
traceWrite(`NAVIGATE`, traceCategories.Navigation);
|
||||
}
|
||||
|
||||
this._pushInFrameStack();
|
||||
|
||||
const entry = buildEntryFromArgs(param);
|
||||
const page = Builder.createViewFromEntry(entry) as Page;
|
||||
|
||||
this._pushInFrameStack();
|
||||
|
||||
const backstackEntry: BackstackEntry = {
|
||||
entry: entry,
|
||||
resolvedPage: page,
|
||||
|
||||
@@ -483,6 +483,13 @@ export class Frame extends FrameBase {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user