ユーザーが間違った認証情報でログインしようとすると「エラーモーダル」と表示されます。 nextProps.errorMsgが未定義であるかどうかを確認しています。エラーメッセージがある場合は、エラーモーダルを示します。エラー小道具の扱い方は? (エラーモーダルが1回だけポップアップする)
最初の試行でのみ動作します。また、 'Can not Find Account'からprops.errorMsgを ''またはundefinedに設定すると、componentWillReceivePropsが呼び出されなかったことがわかりました。ここで
componentWillReceiveProps(nextProps) {
// onAuthComplete Pass twice. so. it's
console.log('yo');
console.log(nextProps.errorMsg);
if(nextProps.errorMsg) {
this._showModal(); <<- here
}
this.setState({isLoading:true});
if (nextProps.hType==1 || nextProps.hType==2) {
nextProps.navigation.navigate('Feed');
this.setState({ password: ''})
}
}
_hideModal =() => {
// empty error
this.props.emptyErrorMsg;
this.setState({ isModalVisible: false });
}
あなたはコメントで指摘
export const emptyErrorMsg =() => ({
type: EMPTY_ERROR_MSG
})
これはfunc 'this.props.emptyErrorMsg'を呼び出さなかった' typho'ですか? – Panther
???私はチョポを見ません。より具体的になりますか? –
私はreact-reduxを使用しており、emptyErrorMsg promiseをディスパッチしています。私はあなたの答えについて少し混乱しています。 –