react-native-dropdown-picker icon indicating copy to clipboard operation
react-native-dropdown-picker copied to clipboard

How to display selected items for multiple selection

Open kerbaypapilon opened this issue 3 years ago • 7 comments

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?

kerbaypapilon avatar Jun 14 '21 15:06 kerbaypapilon

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 avatar Jun 16 '21 12:06 kerbaypapilon

@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

asif-mistry avatar Jun 17 '21 06:06 asif-mistry

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?

kerbaypapilon avatar Jun 17 '21 07:06 kerbaypapilon

If you find out please let me know. 👍

asif-mistry avatar Jun 17 '21 08:06 asif-mistry

@kerbaypapilon can you give my branch a try? https://github.com/asif-mistry/react-native-dropdown-picker/tree/wrapSelectedItems

asif-mistry avatar Aug 03 '21 14:08 asif-mistry

If it works and seems generally useful, I'll happily review (and ideally merge + release) a PR :-)

mikehardy avatar Aug 03 '21 18:08 mikehardy

DropDownPicker.setMode("BADGE"); how to set this mode when you are testing this component in snack expo. Any kind of help is really appriciated

soumenmt avatar Dec 30 '21 03:12 soumenmt