简体   繁体   English

React-native - Dropdownpicker - undefined 不是对象(评估“choice.label”)

[英]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.

相关问题 【React-native】undefined不是对象(评估&#39;_this.props.navigation.navigate&#39;) - 【React-native】undefined is not an object (evaluating '_this.props.navigation.navigate') React-Native Undefined不是对象(评估&#39;this.refs。[&#39;DRAWER&#39;]) - React-Native Undefined is not an object (evaluating 'this.refs.['DRAWER']) react-native:TypeError:undefined 不是 object(正在评估“this.state”) - react-native : TypeError:undefined is not an object (evaluating 'this.state') React-native:undefined不是对象(评估&#39;_this3.props.navigation.navigate&#39;) - React-native: undefined is not an object (evaluating '_this3.props.navigation.navigate') React-Native:TypeError:undefined 不是对象(评估“_this.props.item”) - React-Native: TypeError: undefined is not an object (evaluating '_this.props.item') undefined 不是 object(评估 'this.props = props') - undefined is not an object (evaluating 'this.props = props') React-Native expo React-Native-未定义不是对象(“评估_react3.default.PropTypes.shape”) - React-Native – undefined is not an object (“evaluating _react3.default.PropTypes.shape”) react-native: undefined 不是带有反应导航的对象(评估“_this2.props.navigation”) - react-native: undefined is not an object (evaluating '_this2.props.navigation') with react navigation 在将React-Navigation和Redux用于React-Native App时,undefined不是对象(正在评估&#39;action.routeName&#39;) - undefined is not an object (evaluating 'action.routeName') while using React-Navigation and Redux for React-Native App undefined 不是一个对象 react-native - undefined is not an object react-native
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM