「未定義のオブジェクト( 『_this2.onLoginSuccess.bind』を評価する)ではありません」私は反応するネイティブの中でユーザーをログに記録するには、簡単な例を以下しています。私は リアクト - ネイティブエラーが
ことを処理するために、次のコードを追加しましたonButtonPress() {
const { email, password } = this.state;
this.setState({ error: '', loading: true });
firebase.auth().signInWithEmailAndPassword(email, password)
.then(this.onLoginSuccess.bind(this))
.catch(() => {
firebase.auth().createUserWithEmailAndPassword(email, password)
.then(this.onLoginSucess.bind(this))
.catch(this.onLoginFail.bind(this));
});
}
onLoginSuccess() {
this.setState({
email: '',
password: '',
loading: false,
error: ''
});
}
onLoginFail() {
this.setState({
error: 'Authentication Failed',
loading: false
});
}
が、私は私が反応し、ネイティブのは非常に新しいです"undefined is not an object (evaluating '_this2.onLoginSuccess.bind')
」
エラーを取得し、そう説明してください。
おそらく、あなたがイベントハンドラとして使っているので、おそらく 'onButtonPress'が正しくバインドされていないと思います。 – Li357