2
I want to put the Picker to start with: "Select", the only alternative I found was to determine a Picker.item with label="Select" and value=" ". However it looks unpleasant at the time the user will select, look at the image below:
My code is like this:
<Picker
selectedValue={this.props.genero}
onValueChange={this.props.modificaGenero}
style={{ height: 35, width: 150 }}>
<Picker.Item label="Selecione" value="" />
<Picker.Item label="Masculino" value="masculino" />
<Picker.Item label="Feminino" value="feminino" />
</Picker>
I’m sure this is a wrong programming practice.
In my projects I end up using the same way you did. Following this answer https://stackoverflow.com/a/42209072/9671639 from soen, I believe it would be a normal way to solve the problem.
– sant0will