【发布时间】:2021-06-06 02:30:24
【问题描述】:
我在我的项目中使用@react-native-picker/picker,并且列表仅在第一次单击选择器后呈现。
<Picker
selectedValue={"null"}
style={{ color: "#000" }}
onValueChange={(itemValue, itemIndex) => {
let state = this.state;
state.grupo = itemValue;
this.setState(state);
console.log(this.state.grupo);
}}>{this.state.listaServicos.map((item, i ) => {
return <Picker.Item color="#fff" key={item.key} label={item.label} value={item.value} />
})}</Picker>
【问题讨论】:
-
因为你设置了picker的默认值为null
selectedValue={"null"}直接去掉
标签: react-native react-native-picker