Как я могу перейти от экрана внутри DrawerNavigator к другому внутри того же DrawerNavigator - PullRequest
1 голос
/ 26 мая 2019

Когда мой пользователь обновляет свой адрес электронной почты (на экране ChangeMail), я хотел бы перенаправить его на первый экран DrawerNavigator: «Упражнения»

Я не понимаю, как работает this.props.navigationв этом случае.


const drawerNavigator = createDrawerNavigator({
    Exercices: {
        screen: stackNavigator
    },
    ResetPassword: {
        screen: ResetPassword
    },
    ChangeMail: {
        screen: ChangeMail
    },
    DeleteAccount: {
        screen: DeleteAccount
    },
    Disconnect: {
        screen: ExitScreen
    }
})


//inside the ChangeMail screen
changeEmail = (currentPassword, newEmail) => {
        this.reauthenticate(currentPassword).then(() => {
            var user = firebase.auth().currentUser;
            user.updateEmail(newEmail).then(() => {
                console.log("Email updated!");
            }).catch((error) => { console.log(error); });
        }).catch((error) => { console.log(error); }).then(() => {
            updateDatabaseEmail(newEmail)
        }).then(() => this.props.navigation.navigate("Exercice"))
          //not working

    }

1 Ответ

1 голос
/ 26 мая 2019

Ваше имя маршрута Exercices, но вы переходите к Exercice

this.props.navigation.navigate("Exercices")
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...