Missing stuff from the previos commit 😂
parent
76e3f98c10
commit
e1b9c6f8b4
|
@ -6,6 +6,7 @@ import utils from '../utils';
|
|||
|
||||
class Autocomplete extends React.Component {
|
||||
static propTypes = {
|
||||
auto: React.PropTypes.bool,
|
||||
className: React.PropTypes.string,
|
||||
dataSource: React.PropTypes.any,
|
||||
disabled: React.PropTypes.bool,
|
||||
|
@ -18,6 +19,7 @@ class Autocomplete extends React.Component {
|
|||
};
|
||||
|
||||
static defaultProps = {
|
||||
auto: true,
|
||||
className: '',
|
||||
dataSource: {},
|
||||
multiple: true
|
||||
|
@ -73,13 +75,10 @@ class Autocomplete extends React.Component {
|
|||
handleFocus = () => {
|
||||
const client = event.target.getBoundingClientRect();
|
||||
const screen_height = window.innerHeight || document.documentElement.offsetHeight;
|
||||
const up = this.props.auto ? client.top > ((screen_height / 2) + client.height) : false;
|
||||
|
||||
this.refs.suggestions.scrollTop = 0;
|
||||
this.setState({
|
||||
active: '',
|
||||
up: client.top > ((screen_height / 2) + client.height),
|
||||
focus: true
|
||||
});
|
||||
this.setState({active: '', up: up, focus: true});
|
||||
};
|
||||
|
||||
handleBlur = () => {
|
||||
|
|
|
@ -29,6 +29,7 @@ const AutocompleteTest = () => (
|
|||
|
||||
| Name | Type | Default | Description|
|
||||
|:-----|:-----|:-----|:-----|
|
||||
| `auto` | `Boolean` | `true` | If true, the autocomplete will open to the best possible direction |
|
||||
| `className` | `String` | `''` | Sets a class to style of the Component.|
|
||||
| `dataSource` | `Object` or `Array` | | Object of key/values or array representing all items suggested.|
|
||||
| `disabled` | `Bool` | `false` | If true, component will be disabled.|
|
||||
|
|
Loading…
Reference in New Issue