Show placeholder on Android, iOS works well
Show first Picker.Item element
I changed to default <Picker.Item label={label]} value={null}/> and show this now, but I need remove that item for current work
@ihusak Android Picker does not support placeholder, documented
I changed to default
and show this now, but I need remove that item for current work
I did not get this, can you be more clear
@SupriyaKalghatgi I added <Picker.Item label={label]} value={null}/> and it's added me another item to my checklist, but user can choose it and send value null, I write some function to prevent errors. But placeholder will be perfect solve for this task
@ihusak I have stated above that
Android Picker does not support placeholder, documented
I created my own Picker Component (abstracting away the Native Base Picker) which has an option to display a Placeholder both for Android and iOS by inserting a 'Please select …' option to the options array. Upon selection of a Picker Item, this additional 'Please select …' options gets removed.
Quite simple really.
I think this same approach could be used by Native Base itself to get feature parity regarding the Picker Placeholder between iOS and Android.
It's already 2019, and Picker still not supporting placeholder in Android.
It's already 2019, and Picker still not supporting placeholder in Android.
You can do like this:
//return each items after mapping over the list items
const selectionItems = props.selectionList.map((item, index) => {
return
})
// this is the important part. put the placeholder value in the array by appending the value at the beginning of the array. Since placeholder prop is not selected in Android.
selectionItems.unshift(
placeholder={props.placeholder}
>
{selectionItems}
It's already 2020, and Picker still not supporting placeholder in Android.
It's already 2020, and Picker still not supporting placeholder in Android.
Picker doesn't show placeHolder value in Android.
iosIcon={
style={{
color: '#174A7A',
fontSize: 20
}}
placeholder="Select your Country*"
placeholderStyle={{ color: "#bfc6ea", fontSize: 20 }}
selectedValue={this.state.selected}
onValueChange={this.onValueChange.bind(this)}>
Picker placeholder doesn't work in Android.
Most helpful comment
It's already 2019, and Picker still not supporting placeholder in Android.