ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

setRoot doesn't work with sidemenu template, screen freeze, header broken.

Open synga opened this issue 9 years ago • 4 comments

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.

  1. The setRoot doesn't works with sidemenu.
  2. If i quit the app and open it again, none ion-header is shown.
  3. 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.
  4. 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:

Login Page freezed after login atempt

home

error

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

synga avatar Jan 05 '17 23:01 synga

This sure looks like a support request to me. Perhaps better suited for the support forums.

rapropos avatar Jan 05 '17 23:01 rapropos

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;
        });
    }
}

wbhob avatar Jan 06 '17 02:01 wbhob

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!

jgw96 avatar Jan 10 '17 20:01 jgw96

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.

ionitron-bot[bot] avatar Sep 05 '18 05:09 ionitron-bot[bot]