@@ -15,6 +15,7 @@ import {Colors} from '../../style';
15
15
import Assets from '../../assets' ;
16
16
import { Constants , asBaseComponent , BaseComponentInjectedProps } from '../../commons/new' ;
17
17
import TextField , { TextFieldProps , TextFieldMethods } from '../textField' ;
18
+ import type { DialogMigrationProps } from '../../incubator/Dialog' ;
18
19
import { DialogProps } from '../dialog' ;
19
20
import View from '../view' ;
20
21
import Button from '../button' ;
@@ -23,78 +24,76 @@ import useOldApi, {OldApiProps} from './useOldApi';
23
24
24
25
export type DateTimePickerMode = 'date' | 'time' ;
25
26
26
- export type DateTimePickerProps = OldApiProps & Omit < TextFieldProps , 'value' | 'onChange' > & {
27
- /**
28
- * The type of picker to display ('date' or 'time')
29
- */
30
- mode ?: DateTimePickerMode ;
31
- /**
32
- * The initial value to set the picker to. Defaults to device's date / time
33
- */
34
- value ?: Date ;
35
- /**
36
- * The onChange callback
37
- */
38
- onChange ?: ( date : Date ) => void ;
39
- /**
40
- * Should this input be editable or disabled
41
- */
42
- editable ?: boolean ;
43
- /**
44
- * The minimum date or time value to use
45
- */
46
- minimumDate ?: Date ;
47
- /**
48
- * The maximum date or time value to use
49
- */
50
- maximumDate ?: Date ;
51
- /**
52
- * A callback function to format the time or date
53
- * @param mode the type of the picker ('date' or 'time')
54
- * @returns the formatted string to display
55
- */
56
- dateTimeFormatter ?: ( value : Date , mode : DateTimePickerMode ) => string ;
57
- /**
58
- * Allows changing of the locale of the component (iOS only)
59
- */
60
- locale ?: string ;
61
- /**
62
- * Allows changing of the time picker to a 24 hour format (Android only)
63
- */
64
- is24Hour ?: boolean ;
65
- /**
66
- * The interval at which minutes can be selected. Possible values are: 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30 (iOS only)
67
- */
68
- minuteInterval ?: number ;
69
- /**
70
- * Allows changing of the timeZone of the date picker. By default it uses the device's time zone (iOS only)
71
- */
72
- timeZoneOffsetInMinutes ?: number ;
73
- /**
74
- * Props to pass the Dialog component
75
- */
76
- dialogProps ?: DialogProps ;
77
- /**
78
- * style to apply to the iOS dialog header
79
- */
80
- headerStyle ?: StyleProp < ViewStyle > ;
81
- /**
82
- * Render custom input
83
- */
84
- renderInput ?: ( props : Omit < DateTimePickerProps , 'value' > & { value ?: string } ) => React . ReactElement ;
85
- /**
86
- * Override system theme variant (dark or light mode) used by the date picker.
87
- */
88
- themeVariant ?: 'light' | 'dark' ;
89
- /**
90
- * The component testID
91
- */
92
- testID ?: string ;
93
- /**
94
- * Allows changing the visual display of the picker
95
- */
96
- display ?: string ;
97
- } ;
27
+ export type DateTimePickerProps = OldApiProps &
28
+ Omit < TextFieldProps , 'value' | 'onChange' > &
29
+ DialogMigrationProps & {
30
+ /**
31
+ * The type of picker to display ('date' or 'time')
32
+ */
33
+ mode ?: DateTimePickerMode ;
34
+ /**
35
+ * The initial value to set the picker to. Defaults to device's date / time
36
+ */
37
+ value ?: Date ;
38
+ /**
39
+ * The onChange callback
40
+ */
41
+ onChange ?: ( date : Date ) => void ;
42
+ /**
43
+ * Should this input be editable or disabled
44
+ */
45
+ editable ?: boolean ;
46
+ /**
47
+ * The minimum date or time value to use
48
+ */
49
+ minimumDate ?: Date ;
50
+ /**
51
+ * The maximum date or time value to use
52
+ */
53
+ maximumDate ?: Date ;
54
+ /**
55
+ * A callback function to format the time or date
56
+ * @param mode the type of the picker ('date' or 'time')
57
+ * @returns the formatted string to display
58
+ */
59
+ dateTimeFormatter ?: ( value : Date , mode : DateTimePickerMode ) => string ;
60
+ /**
61
+ * Allows changing of the locale of the component (iOS only)
62
+ */
63
+ locale ?: string ;
64
+ /**
65
+ * Allows changing of the time picker to a 24 hour format (Android only)
66
+ */
67
+ is24Hour ?: boolean ;
68
+ /**
69
+ * The interval at which minutes can be selected. Possible values are: 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30 (iOS only)
70
+ */
71
+ minuteInterval ?: number ;
72
+ /**
73
+ * Allows changing of the timeZone of the date picker. By default it uses the device's time zone (iOS only)
74
+ */
75
+ timeZoneOffsetInMinutes ?: number ;
76
+ /**
77
+ * style to apply to the iOS dialog header
78
+ */
79
+ headerStyle ?: StyleProp < ViewStyle > ;
80
+ /**
81
+ * Render custom input
82
+ */
83
+ renderInput ?: ( props : Omit < DateTimePickerProps , 'value' > & { value ?: string } ) => React . ReactElement ;
84
+ /**
85
+ * Override system theme variant (dark or light mode) used by the date picker.
86
+ */
87
+ themeVariant ?: 'light' | 'dark' ;
88
+ /**
89
+ * The component testID
90
+ */
91
+ testID ?: string ;
92
+ /**
93
+ * Allows changing the visual display of the picker
94
+ */
95
+ display ?: string ;
96
+ } ;
98
97
99
98
type DateTimePickerPropsInternal = DateTimePickerProps & BaseComponentInjectedProps ;
100
99
@@ -128,6 +127,7 @@ const DateTimePicker = forwardRef((props: DateTimePickerPropsInternal, ref: Forw
128
127
themeVariant = Colors . getScheme ( ) ,
129
128
onChange,
130
129
dialogProps,
130
+ migrateDialog,
131
131
headerStyle,
132
132
testID,
133
133
display = Constants . isIOS ? 'spinner' : undefined ,
@@ -234,12 +234,7 @@ const DateTimePicker = forwardRef((props: DateTimePickerPropsInternal, ref: Forw
234
234
onPress = { toggleExpandableOverlay }
235
235
testID = { `${ testID } .cancel` }
236
236
/>
237
- < Button
238
- link
239
- iconSource = { Assets . icons . check }
240
- onPress = { onDonePressed }
241
- testID = { `${ testID } .done` }
242
- />
237
+ < Button link iconSource = { Assets . icons . check } onPress = { onDonePressed } testID = { `${ testID } .done` } />
243
238
</ View >
244
239
) ;
245
240
} ;
@@ -302,6 +297,7 @@ const DateTimePicker = forwardRef((props: DateTimePickerPropsInternal, ref: Forw
302
297
expandableContent = { Constants . isIOS ? renderIOSExpandableOverlay ( ) : undefined }
303
298
useDialog
304
299
dialogProps = { _dialogProps }
300
+ migrateDialog = { migrateDialog }
305
301
disabled = { editable === false }
306
302
// NOTE: Android picker comes with its own overlay built-in therefor we're not using ExpandableOverlay for it
307
303
renderCustomOverlay = { Constants . isAndroid ? renderAndroidDateTimePicker : undefined }
0 commit comments