gerhat / material-ui-formik-components

Formik ready material ui components
MIT License
85 stars 13 forks source link

Select component unable to get value from option if customize onChange #7

Closed k8martian closed 5 years ago

k8martian commented 5 years ago

The Select field is empty if I use make custom onChange. Anyway to fix this?

<Field
    name="name"
    label="label"
    component={Select}
    options={this.state.options}
    onChange={(e)=>{
            formik.setFieldValue('nameValue', true);
        formik.handleSubmit(e);
    }}
/>

also I get this warning

Warning: Failed prop type: The prop value is marked as required in SelectInput, but its value is undefined.

k8martian commented 5 years ago

i removed handleSubmit the value is now display, and setting initialValues remove the warning.

gerhat commented 5 years ago

@k8martian glad you solved it! Thanks for using material-ui-formik-components.