fix: nested frames order with tabs & suspend/resume (#6528)

This commit is contained in:
Manol Donev
2018-11-14 10:20:52 +02:00
committed by GitHub
parent 950fdcf5e7
commit 7df8038d09
4 changed files with 36 additions and 3 deletions

View File

@@ -251,6 +251,18 @@ export class FrameBase extends CustomLayoutView implements FrameDefinition {
}
}
private isNestedWithin(parentFrameCandidate: FrameBase): boolean {
let frameAncestor: FrameBase = this;
while (frameAncestor) {
frameAncestor = <FrameBase>getAncestor(frameAncestor, FrameBase);
if (frameAncestor === parentFrameCandidate) {
return true;
}
}
return false;
}
private raiseCurrentPageNavigatedEvents(isBack: boolean) {
const page = this.currentPage;
if (page) {
@@ -410,6 +422,23 @@ export class FrameBase extends CustomLayoutView implements FrameDefinition {
return null;
}
public _pushInFrameStackRecursive() {
this._pushInFrameStack();
// make sure nested frames order is kept intact i.e. the nested one should always be on top;
// see https://github.com/NativeScript/nativescript-angular/issues/1596 for more information
const framesToPush = [];
for (const frame of frameStack) {
if (frame.isNestedWithin(this)) {
framesToPush.push(frame);
}
}
for (const frame of framesToPush) {
frame._pushInFrameStack();
}
}
public _pushInFrameStack() {
_pushInFrameStack(this);
}

View File

@@ -158,6 +158,10 @@ export class Frame extends View {
* @private
*/
_pushInFrameStack();
/**
* @private
*/
_pushInFrameStackRecursive();
/**
* @private
*/