Missing stuff from the previos commit 😂

old
Javi Velasco 2015-11-01 23:11:32 +01:00
parent 76e3f98c10
commit e1b9c6f8b4
2 changed files with 5 additions and 5 deletions

View File

@ -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 = () => {

View File

@ -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.|