@@ -6,31 +6,19 @@ import {useDidUpdate} from 'hooks';
6
6
import { Colors } from '../../style' ;
7
7
import Assets from '../../assets' ;
8
8
import { Constants , asBaseComponent , BaseComponentInjectedProps } from '../../commons/new' ;
9
- import TextField from '../textField' ;
9
+ import TextField from '../textField/TextFieldMigrator ' ;
10
10
import { DialogProps } from '../dialog' ;
11
11
import View from '../view' ;
12
12
import Button from '../button' ;
13
13
import ExpandableOverlay , { ExpandableOverlayMethods , RenderCustomOverlayProps } from '../../incubator/expandableOverlay' ;
14
+ import type { TextFieldProps } from '../../incubator/TextField' ;
14
15
15
16
const MODES = {
16
17
DATE : 'date' ,
17
18
TIME : 'time'
18
19
} ;
19
20
20
- /*eslint-disable*/
21
- /**
22
- * @description : Date and Time Picker Component that wraps RNDateTimePicker for date and time modes.
23
- * @example : https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/DateTimePickerScreen.tsx
24
- * @important : DateTimePicker uses a native library. You MUST add and link the native library to both iOS and Android projects.
25
- * @extends : TextField, react-native-community/datetimepicker
26
- * @extendsLink : https://github.com/react-native-community/react-native-datetimepicker#react-native-datetimepicker
27
- * @gif : https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/DateTimePicker/DateTimePicker_iOS.gif?raw=true, https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/DateTimePicker/DateTimePicker_Android.gif?raw=true
28
- */
29
- /*eslint-enable*/
30
-
31
- export interface DateTimePickerProps {
32
- // TODO: extend TextField props
33
- // ...TextField.propTypes,
21
+ export type DateTimePickerProps = Omit < TextFieldProps , 'value' | 'onChange' > & {
34
22
/**
35
23
* The type of picker to display ('date' or 'time')
36
24
*/
@@ -107,10 +95,25 @@ export interface DateTimePickerProps {
107
95
* The component testID
108
96
*/
109
97
testID ?: string ;
98
+ /**
99
+ * Should migrate to the new TextField implementation
100
+ */
101
+ migrateTextField ?: boolean ;
110
102
}
111
103
112
104
type DateTimePickerPropsInternal = DateTimePickerProps & BaseComponentInjectedProps ;
113
105
106
+
107
+ /*eslint-disable*/
108
+ /**
109
+ * @description : Date and Time Picker Component that wraps RNDateTimePicker for date and time modes.
110
+ * @example : https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/DateTimePickerScreen.tsx
111
+ * @important : DateTimePicker uses a native library. You MUST add and link the native library to both iOS and Android projects.
112
+ * @extends : TextField, react-native-community/datetimepicker
113
+ * @extendsLink : https://github.com/react-native-community/react-native-datetimepicker#react-native-datetimepicker
114
+ * @gif : https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/DateTimePicker/DateTimePicker_iOS.gif?raw=true, https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/DateTimePicker/DateTimePicker_Android.gif?raw=true
115
+ */
116
+ /*eslint-enable*/
114
117
function DateTimePicker ( props : DateTimePickerPropsInternal ) {
115
118
const {
116
119
value : propsValue ,
@@ -134,6 +137,7 @@ function DateTimePicker(props: DateTimePickerPropsInternal) {
134
137
// @ts -expect-error
135
138
useCustomTheme,
136
139
testID,
140
+ migrateTextField,
137
141
...others
138
142
} = props ;
139
143
@@ -295,9 +299,9 @@ function DateTimePicker(props: DateTimePickerPropsInternal) {
295
299
{ renderInput ? (
296
300
renderInput ( { ...props , value : getStringValue ( ) } )
297
301
) : (
298
- /* @ts -expect-error */
299
302
< TextField
300
303
{ ...others }
304
+ migrate = { migrateTextField }
301
305
testID = { testID }
302
306
editable = { editable }
303
307
// @ts -expect-error should be remove after completing TextField migration
0 commit comments