[英]React-native - Dropdownpicker - undefined is not an object(evaluating 'choice.label')
I use DropDownPicker in react-native, When page loading i got this error我在 react-native 中使用 DropDownPicker,当页面加载时出现此错误
I use a DropDownPicker as follows:我使用 DropDownPicker 如下:
<DropDownPicker
items={[
{ label: 'Us', value: 'Us' },
{ label: 'Canada, value: 'Canada' }
]}
defaultValue={this.state.country}
containerStyle={{ height: 40 }}
style={{ backgroundColor: '#fafafa' }}
itemStyle={{
justifyContent: 'flex-start'
}}
dropDownStyle={{ backgroundColor: '#fafafa' }}
onChangeItem={item => this.setState({
country: item.value
})}
/>
You are missing a '
with the word Canada:您缺少带有加拿大一词的'
:
items={[
{ label: 'Us', value: 'Us' },
{ label: 'Canada', value: 'Canada' }
]}
Reading Debug Messages读取调试信息
The choice.label
error is a good hint that something is wrong with a label property being passed to DropDownPicker
. choice.label
错误是一个很好的提示,表明传递给DropDownPicker
的 label 属性有问题。 Going forward definitely look out for little hints like this to help guide you to a solution.展望未来,一定要留意这样的小提示,以帮助指导您找到解决方案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.