Redux表单上的提交错误在React Native上不起作用

时间:2018-07-16 08:29:34

标签: reactjs react-native redux redux-form

我正在开发一个具有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>
    )
}

非常感谢

0 个答案:

没有答案