| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -251,6 +251,18 @@ export class FrameBase extends CustomLayoutView implements FrameDefinition { | |||
| 251 | 251 | } | |
| 252 | 252 | } | |
| 253 | 253 | ||
| 254 | + private isNestedWithin(parentFrameCandidate: FrameBase): boolean { | ||
| 255 | + let frameAncestor: FrameBase = this; | ||
| 256 | + while (frameAncestor) { | ||
| 257 | + frameAncestor = <FrameBase>getAncestor(frameAncestor, FrameBase); | ||
| 258 | + if (frameAncestor === parentFrameCandidate) { | ||
| 259 | + return true; | ||
| 260 | + } | ||
| 261 | + } | ||
| 262 | + | ||
| 263 | + return false; | ||
| 264 | + } | ||
| 265 | + | ||
| 254 | 266 | private raiseCurrentPageNavigatedEvents(isBack: boolean) { | |
| 255 | 267 | const page = this.currentPage; | |
| 256 | 268 | if (page) { | |
@@ -410,6 +422,23 @@ export class FrameBase extends CustomLayoutView implements FrameDefinition { | |||
| 410 | 422 | return null; | |
| 411 | 423 | } | |
| 412 | 424 | ||
| 425 | + public _pushInFrameStackRecursive() { | ||
| 426 | + this._pushInFrameStack(); | ||
| 427 | + | ||
| 428 | + // make sure nested frames order is kept intact i.e. the nested one should always be on top; | ||
| 429 | + // see https://github.com/NativeScript/nativescript-angular/issues/1596 for more information | ||
| 430 | + const framesToPush = []; | ||
| 431 | + for (const frame of frameStack) { | ||
| 432 | + if (frame.isNestedWithin(this)) { | ||
| 433 | + framesToPush.push(frame); | ||
| 434 | + } | ||
| 435 | + } | ||
| 436 | + | ||
| 437 | + for (const frame of framesToPush) { | ||
| 438 | + frame._pushInFrameStack(); | ||
| 439 | + } | ||
| 440 | + } | ||
| 441 | + | ||
| 413 | 442 | public _pushInFrameStack() { | |
| 414 | 443 | _pushInFrameStack(this); | |
| 415 | 444 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -158,6 +158,10 @@ export class Frame extends View { | |||
| 158 | 158 | * @private | |
| 159 | 159 | */ | |
| 160 | 160 | _pushInFrameStack(); | |
| 161 | + /** | ||
| 162 | + * @private | ||
| 163 | + */ | ||
| 164 | + _pushInFrameStackRecursive(); | ||
| 161 | 165 | /** | |
| 162 | 166 | * @private | |
| 163 | 167 | */ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -506,7 +506,7 @@ export class TabView extends TabViewBase { | |||
| 506 | 506 | const newItem = items[newIndex]; | |
| 507 | 507 | const selectedView = newItem && newItem.view; | |
| 508 | 508 | if (selectedView instanceof Frame) { | |
| 509 | - selectedView._pushInFrameStack(); | ||
| 509 | + selectedView._pushInFrameStackRecursive(); | ||
| 510 | 510 | } | |
| 511 | 511 | ||
| 512 | 512 | toLoad.forEach(index => { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -261,7 +261,7 @@ export class TabView extends TabViewBase { | |||
| 261 | 261 | const selectedIndex = this.selectedIndex; | |
| 262 | 262 | const selectedView = this.items && this.items[selectedIndex] && this.items[selectedIndex].view; | |
| 263 | 263 | if (selectedView instanceof Frame) { | |
| 264 | - selectedView._pushInFrameStack(); | ||
| 264 | + selectedView._pushInFrameStackRecursive(); | ||
| 265 | 265 | } | |
| 266 | 266 | ||
| 267 | 267 | this._ios.delegate = this._delegate; | |
@@ -300,7 +300,7 @@ export class TabView extends TabViewBase { | |||
| 300 | 300 | if (newItem && this.isLoaded) { | |
| 301 | 301 | const selectedView = items[newIndex].view; | |
| 302 | 302 | if (selectedView instanceof Frame) { | |
| 303 | - selectedView._pushInFrameStack(); | ||
| 303 | + selectedView._pushInFrameStackRecursive(); | ||
| 304 | 304 | } | |
| 305 | 305 | ||
| 306 | 306 | newItem.loadView(newItem.view); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments