Issue
I am trying to add picker in react native android but it does not showing in android. I map my location date to picker item but i did'nt see picker in screen.
<Picker selectedValue={this.state.location}>
<Picker.Item label="Location 1" value="1" />
<Picker.Item label="Location 2" value="2" />
<Picker.Item label="Location 3" value="3" />
</Picker>
Solution
You need to set your onValueChange
method
<Picker
style={{width: 100}}
selectedValue={this.state.location}
onValueChange={(loc) => this.setState({location: loc})}>
<Picker.Item label="Location 1" value="1" />
<Picker.Item label="Location 2" value="2" />
<Picker.Item label="Location 3" value="3" />
</Picker>
Answered By - Chris Geirman
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.