NativeBase icon indicating copy to clipboard operation
NativeBase copied to clipboard

DatePicker: show default date instead of "Select Date" if placeHolderText prop isn't specified

Open 54vanya opened this issue 8 years ago • 3 comments

node, npm, react-native, react and native-base version

node: v9.8.0 react: 16.3.2 native-base: 2.6.1

Expected behaviour

Showing default date if placeHolderText prop isn't specified

Actual behaviour

Picker shows "Select Date" string

Is the bug present in both iOS and Android or in any one of them?

checked only in Android, can't test in ios

54vanya avatar Jul 03 '18 09:07 54vanya

Added with 2.7.1

SupriyaKalghatgi avatar Jul 11 '18 05:07 SupriyaKalghatgi

If anybody is still facing problem, then one use this hack: Assign default date to placeholder text

placeHolderText={this.formatDate(your_default_date)}

export const formatDate = date => {
  return `${date.getMonth() + 1}/${date.getDate()}/${date.getFullYear()}`;
};

swapnil-chougule avatar Jul 01 '19 19:07 swapnil-chougule

Do this, I'm using native base 2.12.1. <DatePicker defaultDate={value} placeHolderText={!value ? placeholder : null} ... />

namquyuit avatar Jul 22 '19 18:07 namquyuit