firebaseAuth.currentUser.linkAndRetrieveDataWithCredential(credential) .then(() => { this.setState({ showInput: false, buttonText: 'I want to link credentials' }) this.props.navigation.navigate('Login'); ToastAndroid.show('Anonymous account linked with credentials', ToastAndroid.SHORT); }) .catch(error => { this.setState({ errorMessage: error.message }, () => { ToastAndroid.show(this.state.errorMessage, ToastAndroid.SHORT); }) });