Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to pass already selected data? #113

Open
premdasvm opened this issue Oct 27, 2022 · 3 comments
Open

How to pass already selected data? #113

premdasvm opened this issue Oct 27, 2022 · 3 comments

Comments

@premdasvm
Copy link

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 ?

@anujd61
Copy link

anujd61 commented Oct 28, 2022

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.

@premdasvm
Copy link
Author

@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

@hoaphantn7604
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants