Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use react-select in react-native?

I'm trying to implement a search form, in my react-native app. For it, I need something like react-select or select-2, both tools are made for web systems and I don't know if is a good idea to use it for a react-native app.

I already tried to install and use it in react-native but this does not appear to work.

like image 346
Jonathan Guerrero Avatar asked Mar 30 '17 18:03

Jonathan Guerrero


People also ask

Can we use select in react native?

react-native-picker-select is a React Native picker component that mimics the native select interface for Android and iOS. Although it emulates the native select interface, it allows developers to customize the interface as they see fit.

How do you use react select in react?

js import React from 'react'; import Select from 'react-select'; ... With those two packages imported, we will be able to have access to the react-select ( <Select />) and also extend the React. Component class. In traditional HTML, the <select> tag houses multiple options and values.

How do you add a select in react?

To select a default option in React, the selected attribute is used in the option element. In React, though, instead of using the selected attribute, the value prop is used on the root select element. So, you can set a default value by passing the value of the option in the value prop of the select input element.


1 Answers

You can't use select2 or react-select with react-native, because it's DOM based and so, it will work only in navigator, not in react-native

The closest react-native equivalent I've found is react-native-multiple-select, you can find it on github at https://github.com/toystars/react-native-multiple-select or install it with

npm i react-native-multiple-select
like image 63
DevTheJo Avatar answered Sep 28 '22 09:09

DevTheJo