Ionic version: (check one with "x")
[ ] 1.x
[x] 2.x
I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/
Current behavior:
When i try to call this.nav.setRoot(TabsPage) or this.nav.push(TabsPage), the ngAfterViewInit callback is calling twice on the TabsPage (page with Tabs component). And the child tab page creates twice.
This problem happen only when i try to navigate from Push plugin (standard phonegap-plugin-push plugin) notification callback.
Expected behavior:
ngAfterViewInit should call once.
Steps to reproduce:
Create push notification callback. Call navigation to the Tabs page from the callback function
Related code:
var push = PushNotification.init({
android: {
senderID: "12345679"
},
browser: {
pushServiceURL: 'http://push.api.phonegap.com/v1/push'
},
ios: {
alert: "true",
badge: true,
sound: 'false'
},
windows: {}
});
push.on('notification', => (data) {
this.navCtrl.push(TabsPage, { data: data }); // or this.navCrtl.setRoot(...). it does not metter.
});
Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):
Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.12
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.45
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.4
Node Version: v6.6.0
Xcode version: Not installed
I also have this issue.
Curious workaround:
ionViewDidEnter() {
this.displayTabs = true
}
Without doing this, tabs inits twice, starts the root page of tab 0 twice, but the second copy doesn't have a tabbar and seems to be pushed onto the nav stack.
I have the same bug :(
when I do setRoot('TabsPage'), the first tab constructor will run twice!
@alexandrzavalii hack from @Lingomat works for me. i'll use this hack until bug will be fixed in the ionic source.
@Lingomat It kind of works for me as well.
But I have several other issues, so I will stick to the older RC
I'm having the same issue with ionic 2 RC5.
I made use of the the workaround mentioned at: https://forum.ionicframework.com/t/after-setroot-tabspage-the-default-tab-page-appears-twice/71770/10
Can some one explain the solution?
curiously it seems that non-root nav controller tabs are not supported ? as per https://github.com/driftyco/ionic/issues/7364#issuecomment-235393132
Is this still the position or are non-root tabs now supported?
Thanks for the issue! This issue is being closed due to inactivity. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
Thank you for using Ionic!
Most helpful comment
Curious workaround:
ionViewDidEnter() {
this.displayTabs = true
}
Without doing this, tabs inits twice, starts the root page of tab 0 twice, but the second copy doesn't have a tabbar and seems to be pushed onto the nav stack.