我正在开发一个具有redux-form集成的表单,我想在提交信息时验证该表单,但无法正常工作:
sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
submit = (values) => {
return sleep(1000).then(() => {
// simulate server latency
throw new SubmissionError({
USERNAME: 'User does not exist',
})
})
}
render() {
const { callbackInput, reset } = this.props;
return (
<React.Fragment>
{callbackInput.map(({ key }) => this.renderField(key))}
<Button xlarge secondary onPress={() => this.props.handleSubmit(this.submit)}>
<Text>Prosegui</Text>
</Button>
</React.Fragment>
)
}
非常感谢