question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: undefined is not an object (evaluating 'choice.label')

See original GitHub issue

Getting 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:closed
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

9reactions
hossein-zarecommented, Jul 4, 2020

Hello,

Your initial value for country is test , It has to be uk or france.

const [state, setState] = useState({country: 'uk'});
0reactions
ptabergcommented, Mar 1, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found