setRoot doesn't work with sidemenu template, screen freeze, header broken.
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:
As followed this tutorial: Ionic 2 Firebase 3 Facebook Login the app seems to crash on so many ways.
- The setRoot doesn't works with sidemenu.
- If i quit the app and open it again, none ion-header is shown.
- After login atempt it freezes the screen, i can click on any menu option (the menu is enabled for testing purpouses) and it doesn't changes the view.
- The hardware back button doesn't quit the app
Expected behavior:
The app should do the login, set the rootpage to the HomePage and show the header bar.
Steps to reproduce:
Related code:
loginFacebook() {
let l = this.load.create({ content: 'Aguarde...' });
l.present();
Facebook.login(['email']).then((response) => {
let facebookCredential = firebase.auth.FacebookAuthProvider.credential(response.authResponse.accessToken);
firebase.auth().signInWithCredential(facebookCredential)
.then((success) => {
firebase.database().ref('Usuarios/' + success.uid).set({
nome: success.displayName,
foto: success.photoURL,
email: success.email
}).then(val => {
console.log(success);
this.storage.set('usuario', JSON.stringify({
id: success.uid,
nome: success.displayName,
foto: success.photoURL,
email: success.email
}));
this.navCtrl.setRoot(HomePage).then(() => {
console.log('vai entrar poptoroot');
this.navCtrl.popToRoot();
});
l.dismiss();
console.log('vai entrar setroot');
});
}).catch((error) => {
console.log("Firebase failure: " + JSON.stringify(error));
l.dismiss();
});
}).catch((error) => {
l.dismiss();
console.log(error);
});
}
Other information:
IMAGE 1: Login Page after login atempt, it freezes the screen but the menu can still me dragged to be shown.
IMAGE 2: After quiting the app and coming back to it, i can drag the menu but there's no header in ANY page.
IMAGE 3: The only error that is shown, it's the same when i try to login or when i come back to the app. Looks like it's not saving on the localStorage (import {Storage} from '@ionic/storage').
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.4
Ionic CLI Version: 2.1.18
Ionic App Lib Version: 2.1.9
Ionic App Scripts Version: 0.0.48
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.9.2
Xcode version: Not installed
This sure looks like a support request to me. Perhaps better suited for the support forums.
Looks like you have the value foto in your template, but not in your component code. EVERY variable you use in the template must be defined before you can use it, like so:
import { Storage } from '@ionic/storage';
@Component({ /* you know this already */ })
export class MyPage {
foto:any;
constructor(public storage: Storage) {
this.storage.get('foto').then(res => {
this.foto = res;
});
}
}
Hello! Thanks for opening an issue with us! As this seems like more of a support question i will urge that you ask this question on our forum or on our slack channel. Thanks for using Ionic!
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. 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.