react-native-dropdown-picker
react-native-dropdown-picker copied to clipboard
How to display selected items for multiple selection
I cannot manage to display selected items after selection. I want to show selected items but it shows for example: 2 item(s) have been selected. How can I change that?
translation={{ SELECTED_ITEMS_COUNT_TEXT:
${items.map(item => {
if (value.includes(item.value)) return item.label + ' -';
})}.replaceAll(',', ' '), }}
I just did like that but I wonder how to do this like in the example: [https://user-images.githubusercontent.com/56504893/116789802-faec4700-aac5-11eb-837b-86f18cbfcf3d.png](url)
@kerbaypapilon I found that the setting mode to "BADGE" does the trick.
DropDownPicker.setMode("BADGE");
https://hossein-zare.github.io/react-native-dropdown-picker-website/docs/advanced/modes
Thank you for answer! It works fine however, when I select many items, some of selected items cannot be seen.(They stayed right sight of the component) Any ideas to make view with multiple lines?
If you find out please let me know. 👍
@kerbaypapilon can you give my branch a try? https://github.com/asif-mistry/react-native-dropdown-picker/tree/wrapSelectedItems
If it works and seems generally useful, I'll happily review (and ideally merge + release) a PR :-)
DropDownPicker.setMode("BADGE"); how to set this mode when you are testing this component in snack expo. Any kind of help is really appriciated