I am trying to use DayPickerInput
with my own custom input, however when typing the input loses focus as soon as a day is selected. This can be seen if trying to type for example: 2020-08-20, when the input gets to '2020-08-2' it selects the 2nd as a date and unfocuses the input, not allowing the user to get to 20.
Here is a code sandbox where I have replicated the problem.
The usage of DayPickerInput:
<DayPickerInput
component={(props) => <CustomInput {...props} />}
value={value}
onDayChange={setValue} />
And my custom input component:
import React from "react";
class Input extends React.Component {
constructor(props) {
super(props);
this.inputRef = React.createRef();
}
focus() {
this.inputRef.current.focus();
}
render() {
return <input {...this.props} ref={this.inputRef} />;
}
}
export default Input;
I have seen this issue, and tried what was explained there, but it does not work and I am not sure what else to try.
Any guidance is appreciated! Thanks!