Is there a way to have a placeholder for the react native picker that is shown before the user clicks on it. The idea would be to have a picker that says "Nationality" and once you click and choose your country it renders the country. I want to do this without having "Nationality" as an available option in the picker.
Place a first children as <Picker.Item value='' label='Placeholder text...' />
I'm not clear this is the right way.
<Picker selectedValue={locals.value}
onValueChange={value => {
if (value != "0")
this.pickerValueChange(value)
// so it won't care if header is selected...
}}>
<Picker.Item label="Select Type" value="0" />
<Picker.Item label="Diesel" value="Diesel" />
<Picker.Item label="Gas" value="Gas" />
<Picker.Item label="Electricity" value="Electricity" />
</Picker>
pickerValueChange function:
pickerValueChange = val => {
// state change or whatever you want to perform on picker update
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With