File tree 4 files changed +14
-14
lines changed
4 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ export const mockAndroidDialogDateChange = (datePickedByUser: Date) => {
17
17
return {
18
18
action : DATE_SET_ACTION ,
19
19
timestamp : pickedDate . getTime ( ) ,
20
+ utcOffset : 0 ,
20
21
} ;
21
22
}
22
23
return ( fakeDateTimePickerAndroidOpener : PresentPickerCallback ) ;
Original file line number Diff line number Diff line change @@ -36,8 +36,8 @@ export type NativeEventIOS = SyntheticEvent<
36
36
export type DateTimePickerEvent = {
37
37
type : AndroidEvtTypes ,
38
38
nativeEvent : $ReadOnly < {
39
- timestamp ? : number ,
40
- utcOffset : number ,
39
+ timestamp : number ,
40
+ utcOffset ? : number ,
41
41
...
42
42
} > ,
43
43
...
@@ -94,15 +94,13 @@ type ViewPropsWithoutChildren = $Diff<
94
94
export type BaseProps = $ReadOnly < { |
95
95
...ViewPropsWithoutChildren ,
96
96
...DateOptions ,
97
-
98
97
/**
99
98
* Timezone in database name.
100
99
*
101
100
* By default, the date picker will use the device's timezone. With this
102
- * parameter, it is possible to force a certain timezone offset. For
103
- * instance, to show times in Pacific Standard Time
101
+ * parameter, it is possible to force a certain timezone based on IANA
104
102
*/
105
- timeZoneName ?: string ,
103
+ timeZoneName ?: ? string ,
106
104
| } > ;
107
105
108
106
export type IOSNativeProps = $ReadOnly < { |
@@ -223,11 +221,8 @@ export type TimePickerOptions = {|
223
221
224
222
export type DateTimePickerResult = $ReadOnly < { |
225
223
action : 'timeSetAction' | 'dateSetAction' | 'dismissedAction' ,
226
- year : number ,
227
- month : number ,
228
- day : number ,
229
- hour : number ,
230
- minute : number ,
224
+ timestamp : number ,
225
+ utcOffset : number ,
231
226
| } > ;
232
227
233
228
export type RCTDateTimePickerNative = Class < HostComponent < IOSNativeProps >> ;
Original file line number Diff line number Diff line change @@ -36,16 +36,19 @@ export function sharedPropsValidation({
36
36
timeZoneOffsetInMinutes,
37
37
} : {
38
38
value : ?Date ,
39
- timeZoneName : ?string ,
40
- timeZoneOffsetInMinutes : ?number ,
39
+ timeZoneName ? : ?string ,
40
+ timeZoneOffsetInMinutes ? : ?number ,
41
41
} ) {
42
42
invariant ( value , 'A date or time must be specified as `value` prop' ) ;
43
43
invariant (
44
44
value instanceof Date ,
45
45
'`value` prop must be an instance of Date object' ,
46
46
) ;
47
47
invariant (
48
- ! ( timeZoneName && timeZoneOffsetInMinutes ) ,
48
+ timeZoneName == null ||
49
+ timeZoneName === undefined ||
50
+ timeZoneOffsetInMinutes == null ||
51
+ timeZoneOffsetInMinutes === undefined ,
49
52
'`timeZoneName` and `timeZoneOffsetInMinutes` cannot be specified at the same time' ,
50
53
) ;
51
54
}
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import DateTimePicker from '../src/index';
9
9
// $FlowExpectedError: complains about import path
10
10
import { DateTimePickerAndroid } from '../src/DateTimePickerAndroid.android' ;
11
11
12
+ // $FlowFixMe[untyped-import]
12
13
import { render , fireEvent , waitFor } from '@testing-library/react-native' ;
13
14
import { createDateTimeSetEvtParams } from '../src/index' ;
14
15
import { mockAndroidDialogDateChange , mockAndroidDialogDismissal } from '../jest' ;
You can’t perform that action at this time.
0 commit comments