iOS | Android |
---|---|
Install library
$ npm i -s react-native-awesome-picker
Import required dependencies.
import AwesomePicker from 'react-native-awesome-picker'
and then in body of your component
state = {language: 'js'}
renderPicker() {
return (
<AwesomePicker
selectedValue={this.state.language}
onValueChange={(itemValue, itemIndex) => this.setState({language: itemValue})}>
<AwesomePicker.Item label="Java" value="java"/>
<AwesomePicker.Item label="JavaScript" value="js"/>
</AwesomePicker>
)
}