React Native Picker only render after click

285 views Asked by At

I'm using @react-native-picker/picker on my project and the list only render after the first click on the picker.

<Picker
    selectedValue={"null"}
    style={{ color: "#000" }}
    onValueChange={(itemValue, itemIndex) => {
    let state = this.state;
    state.grupo = itemValue;
    this.setState(state);
    console.log(this.state.grupo);  
}}>{this.state.listaServicos.map((item, i ) => {
return <Picker.Item color="#fff" key={item.key} label={item.label} value={item.value} />
})}</Picker>
1

There are 1 answers

0
Vasyl Nahuliak On

Use example from library documentation https://github.com/react-native-picker/picker#usage

selectedValue prop in Picker component need be a state value