Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions lib/react-native-multi-select.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import React, { Component } from 'react';
import {
FlatList,
Text,
View,
TextInput,
TouchableWithoutFeedback,
TouchableOpacity,
FlatList,
TouchableWithoutFeedback,
UIManager,
View,
ViewPropTypes
} from 'react-native';
import React, { Component } from 'react';
import styles, { colorPack } from './styles';

import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import PropTypes from 'prop-types';
import reject from 'lodash/reject';
import find from 'lodash/find';
import get from 'lodash/get';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';

import styles, { colorPack } from './styles';
import nodeTypes from './helpers/nodeTypes';
import reject from 'lodash/reject';

// set UIManager LayoutAnimationEnabledExperimental
if (UIManager.setLayoutAnimationEnabledExperimental) {
Expand All @@ -34,6 +34,7 @@ const defaultSearchIcon = (

export default class MultiSelect extends Component {
static propTypes = {
selectedText: PropTypes.string,
single: PropTypes.bool,
selectedItems: PropTypes.array,
items: PropTypes.array.isRequired,
Expand Down Expand Up @@ -117,7 +118,8 @@ export default class MultiSelect extends Component {
onAddItem: () => {},
onClearSelector: () => {},
onToggleList: () => {},
removeSelected: false
removeSelected: false,
selectedText: 'selected'
};

constructor(props) {
Expand Down Expand Up @@ -162,7 +164,7 @@ export default class MultiSelect extends Component {
const foundItem = this._findItem(item);
return get(foundItem, displayKey) || selectText;
}
return `${selectText} (${selectedItems.length} selected)`;
return `${selectText} (${selectedItems.length} ${selectText})`;
};

_findItem = itemKey => {
Expand Down Expand Up @@ -615,7 +617,7 @@ export default class MultiSelect extends Component {
size={20}
onPress={this._clearSelectorCallback}
color={colorPack.placeholderTextColor}
style={{ marginLeft: 5 }}
style={{ marginLeft: 5, marginRight: 10}}
/>
)}
</View>
Expand Down Expand Up @@ -705,7 +707,7 @@ export default class MultiSelect extends Component {
</Text>
<Icon
name={hideSubmitButton ? 'menu-right' : 'menu-down'}
style={styles.indicator}
style={[styles.indicator, { right: -20, height: '100%' }]}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be bad for other users of the library.
I think better to you create another props

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are right but some devices has redundant indicator right margin.

/>
</View>
</TouchableWithoutFeedback>
Expand Down