0

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>
  • because you are set the default value of the picker is null `selectedValue={"null"}` just remove it – shammi Jun 06 '21 at 09:53

1 Answers1

0

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

selectedValue prop in Picker component need be a state value

Vasyl Nahuliak
  • 1,912
  • 2
  • 14
  • 32