Skip to content

Commit a389f6c

Browse files
author
jonisaa
committed
#15 updating lookup component because in the demo it wasn´t working.
1 parent 7318047 commit a389f6c

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

src/components/fieldComponents/Lookup.js

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { Component, PropTypes } from 'react';
22
import FormGroup from '../FormGroup';
3-
import ReSelect from 'react-select';
3+
import Select from 'react-select';
44

55
class Lookup extends Component {
66
fetchItems = () => {
@@ -20,15 +20,22 @@ class Lookup extends Component {
2020

2121
if (!options.url && Array.isArray(options)) {
2222
selectProps = { options, value, name, onChange, onBlur: (event) => onBlur() };
23+
24+
return (
25+
<FormGroup {...formGroupProps}>
26+
<Select {...selectProps}/>
27+
</FormGroup>
28+
)
29+
2330
} else {
24-
selectProps = { value, name, onChange, onBlur: (event) => onBlur(), loadOptions: this.fetchItems, valueKey: options.value? options.value : 'value', labelKey: options.label? options.label : 'label' }
25-
}
31+
selectProps = { value, name, onChange, onBlur: (event) => onBlur(), loadOptions: this.fetchItems, valueKey: options.value? options.value : 'value', labelKey: options.label? options.label : 'label' };
2632

27-
return (
28-
<FormGroup {...formGroupProps}>
29-
<ReSelect.Async {...selectProps}/>
30-
</FormGroup>
31-
)
33+
return (
34+
<FormGroup {...formGroupProps}>
35+
<Select.Async {...selectProps}/>
36+
</FormGroup>
37+
)
38+
}
3239
}
3340
}
3441

0 commit comments

Comments
 (0)