Native Date, Time, Datetime and Yearmonth Picker
- π Date picker
- π Time picker
- ποΈ Datetime picker
- π Yearmonth picker
- π Supports iOS, Android and Web
- π― Selection is single and multiple
- π Renders in modal and inline
- β¨ Highly customizable
| iOS | Android | mWeb - Safari | mWeb - Chrome | Web - Chrome |
|---|---|---|---|---|
![]() | ![]() | ![]() | ![]() | ![]() |
See it in action
demo.mp4
-
Using
npmnpm install @s77rt/react-native-date-picker
-
Using
yarnyarn add @s77rt/react-native-date-picker
import { DatePicker } from "@s77rt/react-native-date-picker"; import type { DatePickerHandle } from "@s77rt/react-native-date-picker";function Example() { const datePicker = useRef<DatePickerHandle>(null); const [selectedDate, setSelectedDate] = useState<Date | null>(null); return ( <> <Text>Selected date: {selectedDate?.toLocaleDateString()}</Text> <View> <Button title="Select date π
" onPress={() => datePicker.current?.showPicker()} /> <DatePicker ref={datePicker} type="date" value={selectedDate} onChange={setSelectedDate} /> </View> </> ); }function Example() { const [selectedDate, setSelectedDate] = useState<Date | null>(null); return ( <> <Text>Selected date: {selectedDate?.toLocaleDateString()}</Text> <DatePicker type="date" value={selectedDate} onChange={setSelectedDate} inline /> </> ); }function Example() { const [selectedDates, setSelectedDates] = useState<Date[]>([]); return ( <> <Text> Selected dates:{" "} {selectedDates ?.map((date) => date.toLocaleDateString()) .join(", ")} </Text> <DatePicker type="date" value={selectedDates} onChange={setSelectedDates} multiple inline /> </> ); }Inherits View Props.
| Prop | Type | Description |
|---|---|---|
ref | Ref<DatePickerHandle> | Ref for the date picker handle. |
type | Type | The type of the picker. |
value | Date | nullDate[] | The selected date(s). |
onChange | (value: Date | null) => void(value: Date[]) => void | Callback when the user changes the selected date(s). |
min | Date | The earliest selectable date(s). |
max | Date | The latest selectable date(s). |
step | number | The stepping interval, in seconds. β«π΅ |
multiple | boolean | Whether the user can select multiple dates. β«π’ |
inline | boolean | Whether the date picker should be displayed inline. β«π’ |
options | Options | Options. Note: Must be memoized (useMemo). β«π’ |
styles | Styles | Styles. Note: Must be memoized (useMemo). β«π’ |
The type of the picker and can be one of the following:
datetimedatetimeβ«π΅yearmonth
Various configuration options.
| Option | Type | Description |
|---|---|---|
locale | string | The locale BCP-47 identifier. β« |
confirmText | string | The confirm button text. β«π’ |
cancelText | string | The cancel button text. β«π’ |
mode | "compact" | "graphical" | "wheel" | The display mode. β« |
title | string | The title. π’ |
headline | string | The headline. π’ |
showModeToggle | boolean | Whether the mode toggle should be shown. π’ |
is24Hour | boolean | Whether the time should be in 24-hour. π’ |
Look and feel styles.
| Style | Type | Description |
|---|---|---|
accentColor | ColorValue | The accent color. β« |
containerColor | ColorValue | The container color. π’ |
titleContentColor | ColorValue | The title color. π’ |
headlineContentColor | ColorValue | The headline color. π’ |
weekdayContentColor | ColorValue | The weekday letters color. π’ |
subheadContentColor | ColorValue | The month and year subhead labels color. π’ |
navigationContentColor | ColorValue | The year and arrow buttons color. π’ |
yearContentColor | ColorValue | The year color. π’ |
disabledYearContentColor | ColorValue | The disabled year color. π’ |
currentYearContentColor | ColorValue | The current year color. π’ |
selectedYearContentColor | ColorValue | The selected year color. π’ |
disabledSelectedYearContentColor | ColorValue | The disabled selected year color. π’ |
selectedYearContainerColor | ColorValue | The selected year container color. π’ |
disabledSelectedYearContainerColor | ColorValue | The disabled selected container color. π’ |
dayContentColor | ColorValue | The day color. π’ |
disabledDayContentColor | ColorValue | The disabled day color. π’ |
selectedDayContentColor | ColorValue | The selected day color. π’ |
disabledSelectedDayContentColor | ColorValue | The disabled selected day color. π’ |
selectedDayContainerColor | ColorValue | The selected day container color. π’ |
disabledSelectedDayContainerColor | ColorValue | The disabled selected day container color. π’ |
todayContentColor | ColorValue | The today color. π’ |
todayDateBorderColor | ColorValue | The today border color. π’ |
dayInSelectionRangeContainerColor | ColorValue | The selected days container color. π’ |
dayInSelectionRangeContentColor | ColorValue | The selected days color. π’ |
dividerColor | ColorValue | The divider color. π’ |
clockDialColor | ColorValue | The clock dial color. π’ |
selectorColor | ColorValue | The clock dial selector color. π’ |
periodSelectorBorderColor | ColorValue | The period selector border color. π’ |
clockDialSelectedContentColor | ColorValue | The selected number color. π’ |
clockDialUnselectedContentColor | ColorValue | The unselected number color. π’ |
periodSelectorSelectedContainerColor | ColorValue | The selected period container color. π’ |
periodSelectorUnselectedContainerColor | ColorValue | The unselected period container color. π’ |
periodSelectorSelectedContentColor | ColorValue | The selected period color. π’ |
periodSelectorUnselectedContentColor | ColorValue | The unselected period color. π’ |
timeSelectorSelectedContainerColor | ColorValue | The selected time container color. π’ |
timeSelectorUnselectedContainerColor | ColorValue | The unselected time container color. π’ |
timeSelectorSelectedContentColor | ColorValue | The selected time color. π’ |
timeSelectorUnselectedContentColor | ColorValue | The unselected time color. π’ |
Imperative handle methods.
| Method | Type | Description |
|---|---|---|
showPicker | () => void | Shows the picker. |
Every code review, bug report and feature request is appreciated! Please feel free to share your feedback.
β« iOS - π’ Android - π΅ Web








