i implemented the react-datepicker in my app.
everythings fine except i want to customize the input field of the datepicker and adapt it to my other custom fields like title input.
when i change the datepicker via the
customInput={<Input />}
field, the looks of it have changed but i cant select dates anymore (the picker isnt working anymore).
heres my code:
<DatePicker
customInput={<Input />}
dateFormat="DD.MM.YYYY"
selected=...
onChange=...
/>
any ideas?
export namespace Input {
export interface Props {
onChange: (event: any) => void;
placeholder?: string;
value?: string | number;
isSecure?: any;
id?: string;
}
// ...
}
So I added the clock event in the following way:
export namespace Input {
export interface Props {
onChange: (event: any) => void;
placeholder?: string;
value?: string | number;
isSecure?: any;
id?: string;
onClick: (event: any) => void;
}
}
is that right?
component code:
export class Input extends React.Component<Input.Props, Input.State> {
public render() {
const controlClass = classNames(
[style.control]
);
const inputClass = classNames(
[style.input]
);
return (
<p className={controlClass} >
<input
id={this.props.id}
onChange={this.props.onChange}
className={inputClass}
type={this.props.isSecure ? "password" : "text"}
placeholder={this.props.placeholder}
value={this.props.value}
/>
</p>
);
}
}