React-day-picker: Disable Manual Input in DayPickerInput

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

I am using DayPickerInput and want user should not be able to edit the date field manually. I tried passing prop 'readOnly' but it's not working.
Here's the snippet-
import DayPickerInput from 'react-day-picker/DayPickerInput'; import {formatDate} from 'react-day-picker/moment';

<DayPickerInput readOnly onDayChange={this.handleDayChange.bind(this, 'maximumDeliveryDate')} format="DD/MM/YYYY" formatDate={formatDate} placeholder="DD/MM/YYYY" value={this.state.maximumDeliveryDate} dayPickerProps={{ selectedDays: this.state.selectedDay, disabledDays: {before: new Date()} }}/>

Am I using the correct prop or is there any other prop to do this?

Most helpful comment

Worked by passing
inputProps={{readOnly: true}} to component.
Ofcourse this thing was mentioned in the documentation, somehow I feel it was not clear.
Closing the issue.

>All comments

Worked by passing
inputProps={{readOnly: true}} to component.
Ofcourse this thing was mentioned in the documentation, somehow I feel it was not clear.
Closing the issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vulcanoidlogic picture vulcanoidlogic  路  6Comments

laidinidis picture laidinidis  路  6Comments

samsch picture samsch  路  6Comments

davidjbradshaw picture davidjbradshaw  路  3Comments

jgatjens picture jgatjens  路  5Comments