react-native-picker-dropdown icon indicating copy to clipboard operation
react-native-picker-dropdown copied to clipboard

Not possible to define placeholder

Open klapperkopp opened this issue 7 years ago • 0 comments

I'd like to define a placeholder item, in case there is no value selected upfront. This doesn't seem to work.

At the moment I solve this by adding a placeholder item into my array first and then not rendering a selection option for it, when opening the Picker Items.

categories: [
                {id: 0, name: 'Choose a category'},
                {id: 1, name: 'Art'},
                {id: 2, name: 'Music'}
            ],
{_.filter(categories, cat => cat.id != 0).map(cat =>
    <Picker.Item
        key={cat.id}
        label={cat.name}
        value={cat.id}
    />
)}

Is there any other way that is better?

I would like something like just setting the placeholder via the placeholder prop on the Picker, or just use the already existing prompt prop on the picker to display this.

klapperkopp avatar Apr 26 '18 00:04 klapperkopp