Picker : undefined is not an object :child.props.value
See original GitHub issueI am trying to return Picker.Item from an array but I face the following error:
undefined is not an object :child.props.value
<Picker style={{ paddingLeft: 100, width:(Platform.OS === 'ios') ? undefined : 120 }}
iosHeader="Selecy"
mode="dropdown"
selectedValue="0"
inLineLabel={true}>
<Picker.Item label="Item 0" value="0" />
{this.props.ItemList.map((member,key)=>{
<Picker.Item label={member.props} value={member.value} />
})
}
</Picker>
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:27 (3 by maintainers)
Top Results From Across the Web
"Undefined is not an object (evaluating 'child.props.value ...
The problem was with react-native version. it's not working in 0.48, but working fine in 0.49. one more thing is Picker is not...
Read more >react-native - Picker - undefined is not an object (evaluating ...
Coding example for the question react-native - Picker - undefined is not an object (evaluating 'this.props.children[position].props)-React Native.
Read more >Controller | React Hook Form - Simple React forms validation
undefined is not a valid value. If your form will invoke reset with default values, you will need to provide useForm with defaultValues...
Read more >How to use react-native-picker-select - LogRocket Blog
Each item is an object with a label and value property. The items appear as options rendered to the user when the select...
Read more >Forms in React Native, The right way
Updated 06/04/2021 : adding select input and date picker Handling ... or return the child without creating a new one if it's not...
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 FreeTop 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
Top GitHub Comments
We found the solution… the bug is quite incredible really.
We are using ImmutableJS for our redux state.
this.props.values
is an immutable list. When you go and look at the source code of Picker.ios.js, you see that it is using lodash’sfind
function. Apparently, they can’t handle an immutable list even though it works throughout the rest of React Native.The (ugly) solution is thus:
{ this.props.values.toArray().map( value => (<Picker.Item key={value} label={value} value={value} />) ) }
Recently I’ve faced the same issue, This might be a less ugly solution This is hapenning because of this