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

multi dropdown default option fix #74

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

PnCodeBreaker
Copy link

This package really is a life saver for us as it allows us to use a searchable dropdown inside a scrollview, other packages we could not use it and in our app we need drop downs everywhere. Though as this package uses scrollview instead of flatlist but even for 100-200 data in dropdowns it is performing quite well.

But the main problem right now with this package is we can't get default option working in MultiSelect Dropdown so if we want to pre-fill selected data then we were unable to do it.

So I have come up with a solution and fixed the multioption default option which was not working. Though I have tested But this feature is a much needed for me so I would request you to test and merge this fix.

In DefaultOption though instead of key value pair we have to give normal array of strings.

<MultipleSelectList setSelected={(val) => setSelected(val)} data={data} save="value" onSelect={() => alert(selected)} label="Categories" defaultOption={['Computers', 'Cameras']} />

So this is how we can use default option.

@Dev2Slope
Copy link

defaultOption={['Computers', 'Cameras']}

What is 'Computers' and 'Cameras'?? key or value? Please specify a little more.

I tried this and its not working, there isn't a new version to update yet.

@PnCodeBreaker
Copy link
Author

defaultOption={['Computers', 'Cameras']}

What is 'Computers' and 'Cameras'?? key or value? Please specify a little more.

I tried this and its not working, there isn't a new version to update yet.

'Computers' and 'Cameras' are values not key. So instead of Object in key, value pairs, default option can be just added with array of values.

I have forked this project & created a different npm release ( as I got no response from the original creator of this package ) also where i have added several enhancements & fixes on top of this package. As I use this package in our company's app also there are several customisations added on my custom fork according to our requirements. Though I have not created a very detailed documentation for that, I will be adding a detailed documentation in future.

I am attaching the link npm : https://www.npmjs.com/package/react-native-dropdown-select-list
Github Repo : https://github.com/PnCodeBreaker/react-native-dropdown-select-list

I would still had preferred to collaborate with the original Devs and it would be better for the entire community.

@danish1658 danish1658 self-assigned this Aug 8, 2023
@danish1658 danish1658 added the enhancement New feature or request label Aug 8, 2023
@danish1658 danish1658 self-requested a review August 8, 2023 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants