You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -301,6 +305,57 @@ Styling of the dialogs on Android can be easily customized by using the provided
301
305
302
306
Refer to this documentation for more information: [android-styling.md](/docs/android-styling.md).
303
307
308
+
### Date range picker (Android only)
309
+
310
+
Android has an additional component that allows users to select a range of dates (start and end dates). This is only available as a Material picker, meaning your application theme must inherit from `Theme.Material3.DayNight.NoActionBar` in `styles.xml`.
311
+
312
+
The component is accessible through an imperative API, similar to the Android date and time pickers.
313
+
314
+
```js
315
+
MaterialRangePicker.open({
316
+
value: {
317
+
start:LAST_SUNDAY,
318
+
end:NEXT_SUNDAY,
319
+
},
320
+
onChange: handleChange,
321
+
fullscreen:true,
322
+
});
323
+
```
324
+
325
+
The range picker supports many of the same props as the Material date picker with a few modifications:
326
+
327
+
### `value` (`optional`)
328
+
329
+
The value is an optional object with two properties: `start` and `end`. Both properties can be `null` or a `Date` object.
330
+
331
+
```js
332
+
MaterialRangePicker.open({
333
+
value: {
334
+
start:newDate(),
335
+
end:newDate(),
336
+
},
337
+
});
338
+
```
339
+
340
+
This will pre-select the range picker with the provided dates. If no value is provided, the user will be able to select any range.
341
+
342
+
### `onChange` (`required`)
343
+
344
+
Range change handler.
345
+
346
+
This is called when the user changes the range. It receives the event and the new range as parameters. The range will be in the same format as the `value` prop.
The utcOffset field is only available on Android and iOS. It is the offset in minutes between the selected date and UTC time.
358
+
304
359
## Component props / params of the Android imperative api
305
360
306
361
> Please note that this library currently exposes functionality from [`UIDatePicker`](https://developer.apple.com/documentation/uikit/uidatepicker?language=objc) on iOS and [DatePickerDialog](https://developer.android.com/reference/android/app/DatePickerDialog) + [TimePickerDialog](https://developer.android.com/reference/android/app/TimePickerDialog) on Android, and [`CalendarDatePicker`](https://docs.microsoft.com/en-us/windows/uwp/design/controls-and-patterns/calendar-date-picker) + [TimePicker](https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.timepicker?view=winrt-19041) on Windows.
0 commit comments