NavControll stuck when pushing pages with insertPages and poping them out,
See original GitHub issueShort description of the problem:
Im trying to push multiply pages using insetPages. Im pushing the pages to the top of the stack. Everything works great until im starting to pop out the pages… All the pages are poping out good but when the first page that was inserted is on the top of the stack the application stuck!
What behavior are you expecting?
the pop should not change his effects
Steps to reproduce:
- create a page with a button that will insertPages, try more then 5 pages to insert
- start clicking the back button on each inserted page.
- the app will stuck
pushPages(i) {
let pagesToPush = []
for(let x=0;x<=i;x++) {
pagesToPush.push({page: ContactPage, params:{pageNumber: x}})
}
this.navCtrl.insertPages(this.navCtrl.length(), pagesToPush);
}
Which Ionic Version? 1.x or 2.x 2.x
Plunker that shows an example of your issue
I was not able to reproduce on plunker but was able by creating a new project. https://github.com/royipressburger/navControll-error-example This one is just clone of the starter tabs. just clone it and run serve --lab
click on one of the buttons… You will see that when pushing 1 or 2 pages all is good but when pushing 3, the app stucks.
Run ionic info
from terminal/cmd prompt: (paste output below)
Cordova CLI: 6.3.1
Ionic Framework Version: 2.0.0-beta.11
Ionic CLI Version: 2.0.0-beta.37
Ionic App Lib Version: 2.0.0-beta.20
OS: Distributor ID: Ubuntu Description: Ubuntu 16.04.1 LTS
Node Version: v5.10.0
Issue Analytics
- State:
- Created 7 years ago
- Comments:6
I thought about the issue some more and it seems to me like the most straightforward solution would be to just iterate over the navigation stack and record the highest Z-index out of all of the views. Once we have that, we can then increment that value by one and set that value as the Z-index of the entering view. That would most certainly ensure that the entering view is visible to the user as it would have the highest Z-index value out of all the views in the navigation stack.
I feel that this is the simplest solution that guarantees a valid Z-index but I’m not sure if performance is a concern here given that we are iterating over the entire navigation stack. Perhaps we should alternatively be storing this maximum Z-index value as a member variable within NavControllerBase?
Cannot reproduce this issue with rc.1 closing for now