Cannot push nav to TabsPage after Facebook.login() promise

I’m working on a situation where users first land on a login page and then authenticate via the Ionic Native Facebook module. When I test this out in an ios emulator, I am able to run the Facebook login method and get a successful response. However, within the promise that is returned from the login method, I try to navigate to the TabsPage and nothing happens.

Usage Example:

Facebook.login(['public_profile']).then(res => {
    
    console.log(res) //Facebook response
    
    this.nav.push(TabsPage); //Nothing happens

}, error => console.log(error));

I have tried navigating to a different page instead of the TabsPage and that does work. I have also tried replacing the content inside of tabs.html file and have isolated the issue to be related to the <ion-tabs> directive. Does anyone have any ideas on what may be causing this unexpected behavior?

Thanks


Your system information:

Cordova CLI: 6.1.1
Gulp version:  CLI version 1.2.1
Gulp local:   Local version 3.9.1
Ionic Framework Version: 2.0.0-beta.4
Ionic CLI Version: 2.0.0-beta.24
Ionic App Lib Version: 2.0.0-beta.14
ios-deploy version: 1.8.5
ios-sim version: 5.0.8
OS: Mac OS X El Capitan
Node Version: v5.9.1
Xcode version: Xcode 7.3 Build version 7D175

I just ran into this as well… no solution yet but I wanted to bump the thread.I also just updated to beta.4 but my app does not use Facebook, so that doesn’t seem to be the issue. I AM however trying to navigate after login with an API. Neither setRoot nor push seem to work for me.

I THINK this is no longer what you think it is, the context has changed.

try

let that  = this
Facebook.login(['public_profile']).then(res => {
    console.log(res) //Facebook response
    that.nav.push(TabsPage); //Nothing happens
}, error => console.log(error));
1 Like

Thanks for the feedback. Don’t think that’s the issue since I’m using arrow functions so this should be bound to the class constructor.

Did any one found a solution or work around for this? I think this happens everytime you try to call nav.push() inside a then(). On android it works fine.

this do work as shown in this https://ionicthemes.com/tutorials/about/ionic2-facebook-login#step3.
Thanks.
But the problem is that when I navigate to tabspage,
the before page is still on top of it.
This problem only occurs after facebook login and I can’t
find the reason.