From 4a411ca679cfeefe358e3fa25867d089ac046664 Mon Sep 17 00:00:00 2001 From: "miguel.arenas" Date: Tue, 2 Oct 2018 08:50:03 -0500 Subject: [PATCH 1/3] Add prop itemNumberOfLines --- lib/react-native-multi-select.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/react-native-multi-select.js b/lib/react-native-multi-select.js index c28d900..a9017de 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, + itemNumberOfLines: PropTypes.number, }; static defaultProps = { @@ -87,7 +88,8 @@ export default class MultiSelect extends Component { onChangeInput: () => {}, displayKey: 'name', canAddItems: false, - onAddItem: () => {} + onAddItem: () => {}, + itemNumberOfLines: 1 }; constructor(props) { @@ -147,7 +149,8 @@ export default class MultiSelect extends Component { uniqueKey, tagTextColor, selectedItems, - displayKey + displayKey, + itemNumberOfLines } = this.props; const actualSelectedItems = optionalSelctedItems || selectedItems; return actualSelectedItems.map(singleSelectedItem => { @@ -175,7 +178,7 @@ export default class MultiSelect extends Component { }, fontFamily ? { fontFamily } : {} ]} - numberOfLines={1} + numberOfLines={itemNumberOfLines} > {item[displayKey]} From 991d7c07dec6c1c7092c2137aa552ed5fdd9382b Mon Sep 17 00:00:00 2001 From: "miguel.arenas" Date: Tue, 2 Oct 2018 09:18:30 -0500 Subject: [PATCH 2/3] Remove itemNumberOfLines Prop, Add Prop widthSelectedItems --- lib/react-native-multi-select.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/react-native-multi-select.js b/lib/react-native-multi-select.js index a9017de..aaf1063 100644 --- a/lib/react-native-multi-select.js +++ b/lib/react-native-multi-select.js @@ -54,7 +54,7 @@ export default class MultiSelect extends Component { onAddItem: PropTypes.func, onChangeInput: PropTypes.func, displayKey: PropTypes.string, - itemNumberOfLines: PropTypes.number, + widthSelectedItems: PropTypes.number }; static defaultProps = { @@ -89,7 +89,7 @@ export default class MultiSelect extends Component { displayKey: 'name', canAddItems: false, onAddItem: () => {}, - itemNumberOfLines: 1 + widthSelectedItems: null }; constructor(props) { @@ -150,7 +150,7 @@ export default class MultiSelect extends Component { tagTextColor, selectedItems, displayKey, - itemNumberOfLines + widthSelectedItems } = this.props; const actualSelectedItems = optionalSelctedItems || selectedItems; return actualSelectedItems.map(singleSelectedItem => { @@ -161,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]} > @@ -178,7 +178,7 @@ export default class MultiSelect extends Component { }, fontFamily ? { fontFamily } : {} ]} - numberOfLines={itemNumberOfLines} + numberOfLines={1} > {item[displayKey]} From 6f30a6a198902f9a714a0915c7218bbae18b70de Mon Sep 17 00:00:00 2001 From: "miguel.arenas" Date: Tue, 2 Oct 2018 09:22:57 -0500 Subject: [PATCH 3/3] Change widthSelectedItems Prop to string --- lib/react-native-multi-select.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/react-native-multi-select.js b/lib/react-native-multi-select.js index aaf1063..8d58fff 100644 --- a/lib/react-native-multi-select.js +++ b/lib/react-native-multi-select.js @@ -54,7 +54,7 @@ export default class MultiSelect extends Component { onAddItem: PropTypes.func, onChangeInput: PropTypes.func, displayKey: PropTypes.string, - widthSelectedItems: PropTypes.number + widthSelectedItems: PropTypes.string }; static defaultProps = {