사용자가 잘못된 자격증 명으로 로그인하려고 시도 할 때 '오류 모달'로 표시됩니다. 내 nextProps.errorMsg가 정의되지 않았는지 아닌지 확인하고 있습니다. 오류 메시지가 있으면 오류 모달을 표시합니다.오류 소품을 처리하는 방법은 무엇입니까? (오류 모달은 한 번만 나타납니다.)
첫 번째 시도에서만 작동합니다. 그리고 'props.errorMsg'를 'Account를 찾을 수 없음'에서 '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
??? 나는 typho를 보지 않는다. 당신은 더 구체적 일 수 있습니까? –
나는 react-redux를 사용하고 있으며 이미 emptyErrorMsg promise를 발송하고 있습니다. 나는 너의 대답에 대해 조금 혼란스러워. –