diff --git a/lib/react-native-multi-select.js b/lib/react-native-multi-select.js index c28d900..8d58fff 100644 --- a/lib/react-native-multi-select.js +++ b/lib/react-native-multi-select.js @@ -53,7 +53,8 @@ export default class MultiSelect extends Component { canAddItems: PropTypes.bool, onAddItem: PropTypes.func, onChangeInput: PropTypes.func, - displayKey: PropTypes.string + displayKey: PropTypes.string, + widthSelectedItems: PropTypes.string }; static defaultProps = { @@ -87,7 +88,8 @@ export default class MultiSelect extends Component { onChangeInput: () => {}, displayKey: 'name', canAddItems: false, - onAddItem: () => {} + onAddItem: () => {}, + widthSelectedItems: null }; constructor(props) { @@ -147,7 +149,8 @@ export default class MultiSelect extends Component { uniqueKey, tagTextColor, selectedItems, - displayKey + displayKey, + widthSelectedItems } = this.props; const actualSelectedItems = optionalSelctedItems || selectedItems; return actualSelectedItems.map(singleSelectedItem => { @@ -158,11 +161,11 @@ export default class MultiSelect extends Component { style={[ styles.selectedItem, { - width: item[displayKey].length * 8 + 60, justifyContent: 'center', height: 40, borderColor: tagBorderColor - } + }, + widthSelectedItems ? {width: widthSelectedItems} : {width: item[displayKey].length * 8 + 60} ]} key={item[uniqueKey]} >