'RNPickerSelect remove "Select an item..."
I'm using RNPickerSelect to as a dropdown in react-native app.
<RNPickerSelect
onValueChange={(value) => setCountry(value)}
value={country}
items={[
{ label: 'United States', value: 'us' },
{ label: 'Canada', value: 'ca' },
]}
/>
and I need two countries, default always should be us, but when I click on it, it shows "Select an item..." which could be also selected. What is the way to remove that option?
Solution 1:[1]
pass blank object in placeholder props
<RNPickerSelect
placeholder={{}}
onValueChange={(value) => setCountry(value)}
value={country}
items={[
{ label: 'United States', value: 'us' },
{ label: 'Canada', value: 'ca' },
]}
/>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Surender Kumar |
