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

How to pass already selected data?

Open premdasvm opened this issue 3 years ago • 3 comments

Hi,

I've a dropdown component where i use react-native-element-dropdown for selecting branches when I try to create a new product. What I'm trying to achieve is to use the same screen for the product's edit. I already have a array of branches previously selected which I need to show as already selected along with my whole like.

I tried updating the array assigned as the value in the MultiSelect component. Is there a way to show selected data ?

premdasvm avatar Oct 27 '22 23:10 premdasvm

Can you share your code? I had the same error just now, the problem I was I was assigning the value array with [{label:1,value:"Foo"}] . Changed the value array to just an array of values like ["Foo"] and it worked.

anujd61 avatar Oct 28 '22 06:10 anujd61

@BigDaddy-Zephyr I was doing the same thing with my value, I changed that to something like ["Foo"] now it's working like you said. Thanks for the help mate.

But theoretically it should work the other way around also right? 🤔 @hoaphantn7604

premdasvm avatar Oct 28 '22 09:10 premdasvm

hi @premdasvm , Currently MultiSelect assigning value ["foo"]. I will upgrade this package to support both formats.

hoaphantn7604 avatar Nov 01 '22 10:11 hoaphantn7604