Migrate from react-native-modal-datetime-picker
- <DateTimePickerModal isVisible={open} mode="date" date={date} onConfirm={setDate} onCancel={close} />
+ <DatePickerSheet open={open} value={date} onConfirm={setDate} onOpenChange={close} />
| modal-datetime-picker | Patine UI |
|---|---|
isVisible | open |
mode="date" | "time" | "datetime" | DatePickerSheet · TimePickerSheet · DateTimePickerSheet |
date | value |
onConfirm(date) | onConfirm(date) (onOpenChange(false) is called right after) |
onCancel | onOpenChange(false) |
confirmTextIOS / cancelTextIOS | confirmLabel / cancelLabel |
minimumDate / maximumDate | minDate / maxDate |
If isVisible was only toggled by a field that shows the date, drop the state and use DatePickerField / TimePickerField / DateTimePickerField with the same props minus visible.
See all migration guides for other libraries, and Comparison for when another library is the better choice.