|
| 1 | +// Type definitions for react-native-modal-datetime-picker |
| 2 | +// Project: https://github.com/mmazzarolo/react-native-modal-datetime-picker |
| 3 | +// Definitions by: Kyle Roach <https://github.com/iRoachie> |
| 4 | +// TypeScript Version: 2.3.2 |
| 5 | + |
| 6 | +import React from 'react' |
| 7 | +import { ViewStyle } from 'react-native' |
| 8 | + |
| 9 | +interface DateTimePickerProps { |
| 10 | + /** |
| 11 | + * The text on the cancel button on iOS |
| 12 | + * |
| 13 | + * Default is 'Cancel' |
| 14 | + */ |
| 15 | + cancelTextIOS?: string |
| 16 | + |
| 17 | + /** |
| 18 | + * The text on the confirm button on iOS |
| 19 | + * |
| 20 | + * Default is 'Confirm' |
| 21 | + */ |
| 22 | + confirmTextIOS?: string |
| 23 | + |
| 24 | + /** |
| 25 | + * A custom component for the cancel button on iOS |
| 26 | + */ |
| 27 | + customCancelButtonIOS?: JSX.Element |
| 28 | + |
| 29 | + /** |
| 30 | + * A custom component for the confirm button on iOS |
| 31 | + */ |
| 32 | + customConfirmButtonIOS?: JSX.Element |
| 33 | + |
| 34 | + /** |
| 35 | + * A custom component for the title container on iOS |
| 36 | + */ |
| 37 | + customTitleContainerIOS?: JSX.Element |
| 38 | + |
| 39 | + /** |
| 40 | + * The style of the container on iOS |
| 41 | + */ |
| 42 | + datePickerContainerStyleIOS?: ViewStyle |
| 43 | + |
| 44 | + /** |
| 45 | + * Initial selected date/time |
| 46 | + * |
| 47 | + * Default is a date object from `new Date()` |
| 48 | + */ |
| 49 | + date?: Date |
| 50 | + |
| 51 | + /** |
| 52 | + * Sets the visibility of the picker |
| 53 | + * |
| 54 | + * Default is false |
| 55 | + */ |
| 56 | + isVisible?: boolean |
| 57 | + |
| 58 | + /** |
| 59 | + * Sets mode to 24 hour time |
| 60 | + * If false, the picker shows an AM/PM chooser on Android |
| 61 | + * |
| 62 | + * Default is true |
| 63 | + */ |
| 64 | + is24Hour?: boolean |
| 65 | + |
| 66 | + /** |
| 67 | + * The mode of the picker |
| 68 | + * |
| 69 | + * Available modes are: |
| 70 | + * date - Shows Datepicker |
| 71 | + * time - Shows Timepicker |
| 72 | + * datetime - Shows a combined Date and Time Picker |
| 73 | + * |
| 74 | + * Default is 'date' |
| 75 | + */ |
| 76 | + mode?: 'date' | 'time' | 'datetime' |
| 77 | + |
| 78 | + /** |
| 79 | + * Toggles the date mode on Android between spinner and calendar views |
| 80 | + * |
| 81 | + * Default is 'calendar' |
| 82 | + */ |
| 83 | + datePickerModeAndroid?: 'spinner' | 'calendar' |
| 84 | + |
| 85 | + /** |
| 86 | + * Title text for the Picker on iOS |
| 87 | + * |
| 88 | + * Default is 'Pick a Date' |
| 89 | + */ |
| 90 | + titleIOS?: string |
| 91 | + |
| 92 | + /** |
| 93 | + * Minimum date the picker can go back to |
| 94 | + */ |
| 95 | + minimumDate?: Date |
| 96 | + |
| 97 | + /** |
| 98 | + * Maximum date the picker can go forward to |
| 99 | + */ |
| 100 | + maximumDate?: Date |
| 101 | + |
| 102 | + /** |
| 103 | + * enum(1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30) |
| 104 | + * The interval at which minutes can be selected. |
| 105 | + * |
| 106 | + * @extends from DatePickerIOSProperties |
| 107 | + */ |
| 108 | + minuteInterval?: number |
| 109 | + |
| 110 | + /** |
| 111 | + * Timezone offset in minutes. |
| 112 | + * By default, the date picker will use the device's timezone. With this parameter, it is possible to force a certain timezone offset. |
| 113 | + * For instance, to show times in Pacific Standard Time, pass -7 * 60. |
| 114 | + * |
| 115 | + * @extends from DatePickerIOSProperties |
| 116 | + */ |
| 117 | + timeZoneOffsetInMinutes?: number |
| 118 | + |
| 119 | + /** |
| 120 | + * Date change handler. |
| 121 | + * This is called when the user changes the date or time in the UI. |
| 122 | + * The first and only argument is a Date object representing the new date and time. |
| 123 | + * |
| 124 | + * @extends from DatePickerIOSProperties |
| 125 | + */ |
| 126 | + onDateChange?( newDate: Date ): void |
| 127 | + |
| 128 | + /** |
| 129 | + * Handler called when the user presses the confirm button |
| 130 | + * Passes the current selected date |
| 131 | + */ |
| 132 | + onConfirm(date: Date): void |
| 133 | + |
| 134 | + /** |
| 135 | + * Handler called when the user presses the cancel button |
| 136 | + * Passes the current selected date |
| 137 | + */ |
| 138 | + onCancel(date: Date): void |
| 139 | +} |
| 140 | + |
| 141 | +export default class DateTimePicker extends React.Component<DateTimePickerProps, any> { } |
0 commit comments