Skip to content

Commit

Permalink
Update docs for gpbl#747, gpbl#742
Browse files Browse the repository at this point in the history
  • Loading branch information
gpbl committed Jul 7, 2018
1 parent ddf3ab5 commit 9de59f6
Showing 1 changed file with 6 additions and 30 deletions.
36 changes: 6 additions & 30 deletions docs/src/pages/api/DayPickerInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,40 +64,16 @@ export default () => (
component <code>string | React.Component = &quot;input&quot;</code>
</h3>
<p>The component class to render the input field.</p>
<CodeBlock
>{`<DayPickerInput component={props => <input {...props} />} />`}</CodeBlock>

<p>
The component must be compatible with the standard HTML{' '}
<code>input</code>: i.e. it should support the
The component must support the
<code>onChange</code>, <code>onFocus</code>, <code>onKeyUp</code>,{' '}
<code>onClick</code> and <code>onBlur</code> props, and the{' '}
<code>onClick</code> and <code>onBlur</code> props. If you want to keep
the focus when the user picks a day, the component class must have a{' '}
<code>focus</code> method.
</p>
<p>
If your custom component doesn’t support such props, wrap it in a
component contaning them. For example:
</p>
<CodeBlock>{`import React from 'react';
import { DayPickerInput } from 'react-day-picker';
import MyInputWithoutFocus from './MyInputWithoutFocus';
class MyInputWithFocus extends React.Component {
focus = () => {
this.input.focus();
}
render() {
return (
<MyInputWithoutFocus
ref={el => (this.input = el)}
{...this.props}
/>
);
}
}
function MyDayPickerInput(props) {
return <DayPickerInput component={MyInputWithFocus} />
}
`}</CodeBlock>

<h3>
<Anchor id="dayPickerProps" />
dayPickerProps <code>Object</code>
Expand Down

0 comments on commit 9de59f6

Please sign in to comment.