How to select multiple values from Picker component in react-native?
Asked Answered
R

1

15

react-native Picker component doesn't seem like providing multiselect option https://facebook.github.io/react-native/docs/picker.html#enabled

But, I have com across some libraries which provides multiselect option like,

https://github.com/toystars/react-native-multiple-select

https://www.npmjs.com/package/react-native-multiple-select-list

But is there any way to select multiple values without going for package?

Referee answered 4/1, 2018 at 6:16 Comment(4)
You can always write your own, but those packages were written to provide functionality on top of the FB library. Why would you not want to use one?Granary
If you just don't like npm i, copy package to your own folder ex: ./src/myfolder/react-native-multiple-select-list then you can import MultiPicker from './src/myfolder/react-native-multiple-select-list' from there.Behoove
@Adam Kipnis, Thank you.Referee
@Val, Thank you.Referee
N
0

As @Adam Kipnis pointed out, you could always write your own.

You can store the values in an array and render from there.

Since the question was asked the developer team has deprecated the default Picker component. They provide a link for community packages. https://reactnative.directory/?search=picker

Ninos answered 3/1, 2022 at 10:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.