I ready set key but it's alway error
Each child in a list should have a unique "key" prop.
const itemsTest = [
{ label: '1', value: '1', key: 1 },
{ label: '2', value: '2', key: 2 },
{ label: '3', value: '3', key: 3 },
{ label: '4', value: '4', key: 4 },
]
class PickerSelect extends Component {
render() {
return (
<View style={Styles.picker}>
<RNPickerSelect
placeholderTextColor={Colors.colorPlaceholder}
placeholder={{ label: this.props.textPlacehoder, color: Colors.colorPlaceholder }}
items={this.props.itemsTest}
onValueChange={(value, index) => this.props.onValueChange(value)}
/>
</View>
);
}
};
Use the bug report template
Just encountred this. Make sure the value of label in placeholder object is not nil, it will be used as a key, In your case the this.props.textPlacehoder. Or you can add key to the placeholder object, then it will be used.
Most helpful comment
Just encountred this. Make sure the value of
labelinplaceholderobject is not nil, it will be used as a key, In your case thethis.props.textPlacehoder. Or you can addkeyto the placeholder object, then it will be used.