TypeError: undefined is not an object (evaluating 'choice.label')
See original GitHub issueGetting the error “TypeError: undefined is not an object (evaluating ‘choice.label’)” when using the DropDownPicker example.
To Reproduce Using react hooks:
const [state, setState] = useState({country: 'test'});
<DropDownPicker items={[ {label: 'UK', value: 'uk'}, {label: 'France', value: 'france'}, ]} defaultValue={state.country} containerStyle={{height: 40}} style={{backgroundColor: '#fafafa'}} dropDownStyle={{backgroundColor: '#fafafa'}} onChangeItem={(item) => setState({ country: item.value, }) } />
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
javascript - undefined is not an object(evaluating 'choice.label')
The choice.label error is a good hint that something is wrong with a label property being passed to DropDownPicker .
Read more >Undefined is not an object (evaluating '_ref3.label') · Issue #137
This error appears when I fill in a text field (not even selecting an option).
Read more >LWC - TypeError: undefined is not an object (evaluating 'e ...
EDIT. There is actually another issue here, and it's a bit sneaky. When you write to this.value you are assigning that value an...
Read more >How to Fix TypeError: Null is Not an Object in JavaScript
The JavaScript error TypeError: null is not an object occurs when a property is accessed or a method is called on a null...
Read more >[Solved]-React-native - Dropdownpicker - undefined is not an ...
Coding example for the question React-native - Dropdownpicker - undefined is not an object(evaluating 'choice.label')-React Native.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hello,
Your initial value for country is
test, It has to beukorfrance.The mistake appears when you pass defaultValue which doesn’t exist in items prop. I think we should make a developer-friendly error message which will not make him surf the web to figure out what’s going on.