反应本机选择器未显示在android中 [英] react native picker is not showing in android
本文介绍了反应本机选择器未显示在android中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在 react native android 中添加选择器,但它没有在 android 中显示.我将我的位置日期映射到选择器项目,但我没有在屏幕中看到选择器.
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>
推荐答案
你需要设置你的onValueChange
方法
我正在尝试在 react native android 中添加选择器,但它没有在 android 中显示.我将我的位置日期映射到选择器项目,但我没有在屏幕中看到选择器.
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
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>
这篇关于反应本机选择器未显示在android中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文