I’m getting some weird behaviour with Android hardware back button.
I have 3 tabs on my app and if I’m on my first tab which is home page, back button closes the app and that is normal. Same happens also on second tab-page when it should go back to first page, but on third tab-page back button goes to first tab-page when it should go to second tab-page because I navigate through them all from first tab to the last tab.
Update, found the reason below: I’m not getting the same behaviour if I start new ionic tabs project, but I don’t see any differences either.
Anyone know why this happens because I don’t know where to even look? Controllers and app are fine as far as I know because I compared them to the starter project.
But I just found out the reason why that was happening. I’m using tabs for navigation and as an abstract state. Index has only ion-nav-view. On my second tab page I have 5 more tabs on top only for that page and when I have these on the second page it breaks the back button behaviour (closes the app) and works normally if I remove them.
Well the problem is that it breaks only on device because of the Android hardware button. I’m not using emulators much because I run tests directly on Nexus 9 or on my HTC One M8.
I don’t have project files at home so I did another project based on starter project tabs with similar structure. It can’t be tested on Codepen because there is no Android back button. I have also this starter project installed on my phone atm with the same behaviour happening.
I tried using those but I just couldn’t think of a way to get similar usability with them.
IonTabs would be much better because I need tabs for five different charts and IonTabs are perfect for that because they are so simple and require only one view for all of them.
I don’t know did you/anyone notice that I also use on that second tab page above each tab content ion-header-bar because without it tab-content would go under tab-bar.
I’m not sure either if I’m just using tabs here wrong way or not.
Hoping to get an answer from someone before I change anything.