๐ง DatePickerAndroid
Deprecated. Use @react-native-community/datetimepicker instead.
Opens the standard Android date picker dialog.
DatePickerAndroid
has been merged withDatePickerIOS
andTimePickerAndroid
into a single component called DateTimePicker and will be removed in a future release.
Example
Reference
Methods
open()
Opens the standard Android date picker dialog.
The available keys for the options
object are:
date
(Date
object or timestamp in milliseconds) - date to show by defaultminDate
(Date
or timestamp in milliseconds) - minimum date that can be selectedmaxDate
(Date
object or timestamp in milliseconds) - maximum date that can be selectedmode
(enum('calendar', 'spinner', 'default')
) - To set the date-picker mode to calendar/spinner/default- 'calendar': Show a date picker in calendar mode.
- 'spinner': Show a date picker in spinner mode.
- 'default': Show a default native date picker(spinner/calendar) based on android versions.
Returns a Promise which will be invoked an object containing action
, year
, month
(0-11), day
if the user picked a date. If the user dismissed the dialog, the Promise will still be resolved with action being DatePickerAndroid.dismissedAction
and all the other keys being undefined. Always check whether the action
is equal to DatePickerAndroid.dateSetAction
before reading the values.
Note the native date picker dialog has some UI glitches on Android 4 and lower when using the minDate
and maxDate
options.
dateSetAction()
A date has been selected.
dismissedAction()
The dialog has been dismissed.