Overview
The DatePicker component accepts all standardViewProps from React Native, plus the following date picker-specific properties.
Required Props
The currently selected date.This prop is required and must be a JavaScript
Date object. The picker will display this date and allow users to modify it.Mode Configuration
The date picker mode that determines what the user can select.
"date"- Only date selection (year, month, day)"time"- Only time selection (hours, minutes)"datetime"- Both date and time selection
Modal Props
Enables the built-in modal wrapper for the date picker.When set to
true, the picker will be displayed in a modal dialog. This requires using the modal-specific props (open, onConfirm, onCancel).Modal only. Controls whether the modal is visible.Set to
true to open the modal, false to close it. This prop only works when modal={true}.Modal only. Callback invoked when the user presses the confirm button.Receives the selected date as a parameter. Typically used to update state and close the modal.
Modal only. Callback invoked when the user presses the cancel button or closes the modal by pressing outside.Typically used to close the modal without updating the selected date.
Inline Props
Inline only. Date change handler called when the user changes the date or time in the UI.This callback is invoked continuously as the user scrolls through the picker. The first and only argument is a
Date object representing the new date and time.Date Range Constraints
Minimum selectable date that restricts the range of possible date/time values.Users will not be able to select dates before this value.
Maximum selectable date that restricts the range of possible date/time values.Users will not be able to select dates after this value.
Time Configuration
The interval at which minutes can be selected.For example, setting this to
15 will only allow selection of minutes at 0, 15, 30, and 45.Changes how 24/12-hour format should be determined.
"device"- Use the device’s system settings (Android default)"locale"- Determine from the locale prop (iOS default, iOS cannot be changed)
Timezone offset in minutes.By default, the date picker uses the device’s timezone. With this parameter, you can force a certain timezone offset. For instance, to show times in Pacific Standard Time, pass
-7 * 60 (-420).Localization
The locale for the date picker.Changes language, date order, and AM/PM preferences. Value needs to be a valid Locale ID.Examples:
"en", "fr", "es", "de", "en_GB", "zh", "ja"Styling Props
The color theme of the picker.
"light"- Light theme"dark"- Dark theme"auto"- Automatically matches system theme
Color of the confirm and cancel buttons in the Android modal.Android modal only. Accepts any valid color string (hex, rgb, named colors).
Color of the divider/separator line in the picker.Android only. Accepts any valid color string (hex, rgb, named colors).
Modal Text Customization
Modal only. The title text displayed at the top of the modal.Set to
null to remove the title completely. Default title is “Select date” for date/datetime modes and “Select time” for time mode.Modal only. Text for the confirm button.Use this to customize the button text or provide translations.
Modal only. Text for the cancel button.Use this to customize the button text or provide translations.
Event Handlers
Spinner state change handler.Called when the user starts to spin the picker wheel and when the spinner stops. Can be used to disable a confirm button until the spinner comes to a complete stop to ensure the expected date is being selected.Android inline only.