我正在尝试将 React-Toolbox Input 组件与 Redux-Form 集成。但是,输入组件在键入时保持为空。我使用https://github.com/react-toolbox/react-toolbox/issues/1293作为集成指南。
import React from 'react'
import PropTypes from 'prop-types'
import { Field, reduxForm } from 'redux-form'
import Input from 'react-toolbox/lib/input'
const renderField = ({ input, meta, ...props }) => (
<Input
{ ...input }
{ ...props }
error={ meta.touched && meta.error } />
)
const Form = ({ handleSubmit }) => (
<form onSubmit={handleSubmit}>
<Field
name="myTextField"
component={renderField}
type="text"
/>
</form>
)
Form.propTypes = {
handleSubmit: PropTypes.func.isRequired,
}
export default reduxForm({
form: 'myForm',
})(Form)
这是使用react-toolbox
2.0.0-beta.12
和redux-form
7.2.0