Skip to main content
Version: Next 🚧

Migrate from react-native-ui-datepicker

- import DateTimePicker from 'react-native-ui-datepicker';
+ import { DatePicker } from '@elik56a/react-native-pickers';

- <DateTimePicker
- mode="range"
- startDate={range.startDate}
- endDate={range.endDate}
- onChange={({ startDate, endDate }) => setRange({ startDate, endDate })}
- minDate={new Date()}
- min={2}
- />
+ <DatePicker
+ mode="range"
+ value={range}
+ onChange={setRange}
+ minDate={new Date()}
+ minRangeDays={2}
+ />

Values are plain Dates in local time, not dayjs objects, and the callbacks pass the value itself rather than an object to unpack.

ui-datepickerReact Native Pickers
mode="single" + date + onChange({ date })value + onChange(date)
mode="range" + startDate / endDatevalue: { start, end } + onChange(range)
mode="multiple" + dates + onChange({ dates })value: Date[] + onChange(dates)
min / max (nights, range)minRangeDays / maxRangeDays (nights)
max (multiple)maxSelections
minDate / maxDateminDate / maxDate (Date)
disabledDates (array or function)isDateDisabled(date), or markedDates[key].disabled
enabledDatesisDateDisabled={(d) => !isAllowed(d)}
firstDayOfWeekfirstDayOfWeek
month / year / onMonthChange / onYearChangeinitialMonth (Date) / onMonthChange(month: Date)
initialView="month" / "year"enableQuickJump: tap the title for months and years
timePicker / use12HoursDateTimePicker with format="12h"
showOutsideDaysshowOutsideDays
hideWeekdays / weekdaysFormatshowWeekdays={false} / weekdayFormat
localelocale (names from Intl, no dayjs locale imports)
timeZone— (dates are the device's local time)
calendar="jalali"—
styles / classNames / componentstheme, styles slots, renderDay, renderArrow
—mode="ranges", markedDates with dots and labels (prices), DatePickerSheet and DatePickerField

DatePicker has no dependency, so dayjs isn't needed. See ranges and multiple dates for the range rules.

See all migration guides for other libraries, and Comparison for when another library is the better choice.