@@ -64,40 +64,16 @@ export default () => (
6464 component < code > string | React.Component = "input"</ code >
6565 </ h3 >
6666 < p > The component class to render the input field.</ p >
67+ < CodeBlock
68+ > { `<DayPickerInput component={props => <input {...props} />} />` } </ CodeBlock >
69+
6770 < p >
68- The component must be compatible with the standard HTML{ ' ' }
69- < code > input</ code > : i.e. it should support the
71+ The component must support the
7072 < code > onChange</ code > , < code > onFocus</ code > , < code > onKeyUp</ code > ,{ ' ' }
71- < code > onClick</ code > and < code > onBlur</ code > props, and the{ ' ' }
73+ < code > onClick</ code > and < code > onBlur</ code > props. If you want to keep
74+ the focus when the user picks a day, the component class must have a{ ' ' }
7275 < code > focus</ code > method.
7376 </ p >
74- < p >
75- If your custom component doesn’t support such props, wrap it in a
76- component contaning them. For example:
77- </ p >
78- < CodeBlock > { `import React from 'react';
79- import { DayPickerInput } from 'react-day-picker';
80- import MyInputWithoutFocus from './MyInputWithoutFocus';
81-
82- class MyInputWithFocus extends React.Component {
83- focus = () => {
84- this.input.focus();
85- }
86- render() {
87- return (
88- <MyInputWithoutFocus
89- ref={el => (this.input = el)}
90- {...this.props}
91- />
92- );
93- }
94- }
95-
96- function MyDayPickerInput(props) {
97- return <DayPickerInput component={MyInputWithFocus} />
98- }
99- ` } </ CodeBlock >
100-
10177 < h3 >
10278 < Anchor id = "dayPickerProps" />
10379 dayPickerProps < code > Object</ code >
0 commit comments