DateTimePicker
A date and time picker compatible with @react-native-community/datetimepicker.
A DateTimePicker component with an API compatible with @react-native-community/datetimepicker. It uses Jetpack Compose on Android and SwiftUI on iOS, providing a modern Material 3 and SwiftUI appearance by default (the community module defaults to the older look on Android).
DateTimePicker component is fully declarative. Use the presentation prop to render the picker 'inline' directly in the view hierarchy or as a 'dialog' on Android. There is no Android imperative API (DateTimePickerAndroid.open()).
Under the hood this component wraps the platform-specific @expo/ui primitives:
- Android: Jetpack Compose DateTimePicker (inline), DatePickerDialog/TimePickerDialog (dialog)
- iOS: SwiftUI DatePicker
If you need lower-level control (custom modifiers, styles, or layouts), use those primitives directly.
Installation
- npx expo install @expo/uiIf you are installing this in an existing React Native app, make sure to install expo in your project.
Migrating from @react-native-community/datetimepicker
- Update the import from
import DateTimePicker from '@react-native-community/datetimepicker'toimport DateTimePicker from '@expo/ui/datetimepicker'. - There is no imperative
DateTimePickerAndroid.open()API. Render the component and usepresentation="dialog"instead. minuteInterval,textColor,firstDayOfWeek,neutralButton,onNeutralButtonPress,fullscreen,titleandstartOnYearSelectionprops are not supported.- Use
timeZoneName(IANA name) instead oftimeZoneOffsetInMinutes. - The
countdownmode is not supported. onErrorprop is not needed.
Basic usage
import { useState } from 'react'; import DateTimePicker from '@expo/ui/datetimepicker'; export default function DateTimePickerExample() { const [date, setDate] = useState(new Date()); return ( <DateTimePicker value={date} onValueChange={(event, selectedDate) => { setDate(selectedDate); }} mode="date" /> ); }
Time picker
import { useState } from 'react'; import DateTimePicker from '@expo/ui/datetimepicker'; export default function TimePickerExample() { const [date, setDate] = useState(new Date()); return ( <DateTimePicker value={date} onValueChange={(event, selectedDate) => { setDate(selectedDate); }} mode="time" /> ); }
With date constraints
import { useState } from 'react'; import DateTimePicker from '@expo/ui/datetimepicker'; const today = new Date(); const thirtyDaysFromNow = new Date(today.getTime() + 30 * 24 * 60 * 60 * 1000); export default function ConstrainedDatePickerExample() { const [date, setDate] = useState(new Date()); return ( <DateTimePicker value={date} onValueChange={(event, selectedDate) => { setDate(selectedDate); }} mode="date" minimumDate={today} maximumDate={thirtyDaysFromNow} /> ); }
Dialog presentation
On Android, you can use presentation="dialog" to show the picker as a modal dialog. The dialog opens when the component mounts. Unmount it in response to onValueChange or onDismiss. On iOS, this prop is ignored and the picker always renders inline.
import { useState } from 'react'; import { Button, View } from 'react-native'; import DateTimePicker from '@expo/ui/datetimepicker'; export default function AndroidDialogExample() { const [date, setDate] = useState(new Date()); const [show, setShow] = useState(false); return ( <View> <Button title="Pick a date" onPress={() => setShow(true)} /> {show && ( <DateTimePicker value={date} onValueChange={(event, selectedDate) => { setShow(false); setDate(selectedDate); }} onDismiss={() => { setShow(false); }} mode="date" presentation="dialog" /> )} </View> ); }
API
import DateTimePicker from '@expo/ui/datetimepicker';
Component
Type: React.Element<DateTimePickerProps>
stringAccent/tint color applied to the picker.
Maps to color on Android and tint on iOS.
string • Default: 'default'Display style. Android supports 'default' | 'spinner' — 'spinner' shows a text input
rather than a scroll wheel (Material 3 does not have a wheel-style picker).
iOS supports 'default' | 'spinner' | 'compact' | 'inline'.
Acceptable values are: 'default' | 'spinner' | 'compact' | 'inline' | 'calendar' | 'clock'
string • Default: 'date'The picker mode.
Acceptable values are: 'date' | 'time' | 'datetime'
Deprecated: Use
onValueChangeandonDismissinstead.Called when the user changes the date/time or dismisses the picker. The event type is encoded in
event.type. If the new specific listeners are provided, they take precedence.
(event: DateTimePickerEvent, date?: Date) => void() => voidCalled when the picker is dismissed without selecting a value.
(event: DateTimePickerChangeEvent, date: Date) => voidCalled when the user selects a date or time.
string • Default: 'dialog'How the picker is presented.
'inline'renders the picker directly in the view hierarchy.'dialog'shows a modal dialog that opens on mount. FiresonValueChangeon confirmation,onDismisson cancel. The caller should unmount the component in response.
On iOS this prop is accepted but ignored (always inline).
On Android the default is 'dialog'.
Acceptable values are: 'inline' | 'dialog'
stringA test ID forwarded to the native view. Note: on Android dialog presentation, the test ID is not forwarded.
stringForce a specific color scheme on the picker.
Acceptable values are: 'dark' | 'light'
stringIANA time zone name (e.g. 'America/New_York') for the picker display.
Types
| Property | Type | Description |
|---|---|---|
| nativeEvent | {
timestamp: number,
utcOffset: number
} | - |
Deprecated: used with the deprecated
onChangeprop
| Property | Type | Description |
|---|---|---|
| nativeEvent | {
timestamp: number,
utcOffset: number
} | - |
| type | 'set' | 'dismissed' |
|