|
|
|
@ -113,10 +113,12 @@ class EnhancedSelectInput extends Component {
|
|
|
|
|
this._scheduleUpdate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!Array.isArray(this.props.value) && prevProps.value !== this.props.value) {
|
|
|
|
|
this.setState({
|
|
|
|
|
selectedIndex: getSelectedIndex(this.props)
|
|
|
|
|
});
|
|
|
|
|
if (!Array.isArray(this.props.value)) {
|
|
|
|
|
if (prevProps.value !== this.props.value || prevProps.values !== this.props.values) {
|
|
|
|
|
this.setState({
|
|
|
|
|
selectedIndex: getSelectedIndex(this.props)
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -332,6 +334,11 @@ class EnhancedSelectInput extends Component {
|
|
|
|
|
|
|
|
|
|
const isMultiSelect = Array.isArray(value);
|
|
|
|
|
const selectedOption = getSelectedOption(selectedIndex, values);
|
|
|
|
|
let selectedValue = value;
|
|
|
|
|
|
|
|
|
|
if (!values.length) {
|
|
|
|
|
selectedValue = isMultiSelect ? [] : '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
@ -372,15 +379,17 @@ class EnhancedSelectInput extends Component {
|
|
|
|
|
onPress={this.onPress}
|
|
|
|
|
>
|
|
|
|
|
{
|
|
|
|
|
isFetching &&
|
|
|
|
|
isFetching ?
|
|
|
|
|
<LoadingIndicator
|
|
|
|
|
className={styles.loading}
|
|
|
|
|
size={20}
|
|
|
|
|
/>
|
|
|
|
|
/> :
|
|
|
|
|
null
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
!isFetching &&
|
|
|
|
|
isFetching ?
|
|
|
|
|
null :
|
|
|
|
|
<Icon
|
|
|
|
|
name={icons.CARET_DOWN}
|
|
|
|
|
/>
|
|
|
|
@ -400,7 +409,7 @@ class EnhancedSelectInput extends Component {
|
|
|
|
|
onPress={this.onPress}
|
|
|
|
|
>
|
|
|
|
|
<SelectedValueComponent
|
|
|
|
|
value={value}
|
|
|
|
|
value={selectedValue}
|
|
|
|
|
values={values}
|
|
|
|
|
{...selectedValueOptions}
|
|
|
|
|
{...selectedOption}
|
|
|
|
@ -418,15 +427,17 @@ class EnhancedSelectInput extends Component {
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
isFetching &&
|
|
|
|
|
isFetching ?
|
|
|
|
|
<LoadingIndicator
|
|
|
|
|
className={styles.loading}
|
|
|
|
|
size={20}
|
|
|
|
|
/>
|
|
|
|
|
/> :
|
|
|
|
|
null
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
!isFetching &&
|
|
|
|
|
isFetching ?
|
|
|
|
|
null :
|
|
|
|
|
<Icon
|
|
|
|
|
name={icons.CARET_DOWN}
|
|
|
|
|
/>
|
|
|
|
@ -506,7 +517,7 @@ class EnhancedSelectInput extends Component {
|
|
|
|
|
</Manager>
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
isMobile &&
|
|
|
|
|
isMobile ?
|
|
|
|
|
<Modal
|
|
|
|
|
className={styles.optionsModal}
|
|
|
|
|
size={sizes.EXTRA_SMALL}
|
|
|
|
@ -557,7 +568,8 @@ class EnhancedSelectInput extends Component {
|
|
|
|
|
}
|
|
|
|
|
</Scroller>
|
|
|
|
|
</ModalBody>
|
|
|
|
|
</Modal>
|
|
|
|
|
</Modal> :
|
|
|
|
|
null
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|