React-day-picker: Redux form integrration

Created on 11 Feb 2018  路  1Comment  路  Source: gpbl/react-day-picker

How to integrate react-day-picker with redux form?

I have tried:

renderDatePicker (field) {
        const { meta: { touched, error } } = field;
        return (
          <Form.Field>
            <label>{field.label}</label>
            <DayPickerInput 
                {...field.input}
                onDayChange={(day) => console.log(day)} />
            {touched && error && <span>{error}</span>}
          </Form.Field>
        );
    } 

but got no luck. Seems like is not getting {...field.input} as a props. Thank you.

Most helpful comment

Problem fixed. I just put the object {...field.input} inside inputProps={{...field.input}} as inputProps is defined as Additional props to add to the input component. documentation here.

Code:
<DayPickerInput inputProps={{...field.input}} onDayChange={(day) => console.log(day)} />

>All comments

Problem fixed. I just put the object {...field.input} inside inputProps={{...field.input}} as inputProps is defined as Additional props to add to the input component. documentation here.

Code:
<DayPickerInput inputProps={{...field.input}} onDayChange={(day) => console.log(day)} />

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kostiantyn-solianyk picture kostiantyn-solianyk  路  4Comments

michaelgriffithus picture michaelgriffithus  路  5Comments

trevordmiller picture trevordmiller  路  4Comments

brpontes picture brpontes  路  6Comments

thebuilder picture thebuilder  路  3Comments