File tree Expand file tree Collapse file tree 4 files changed +16
-20
lines changed
android/src/main/java/com/reactcommunity/rndatetimepicker Expand file tree Collapse file tree 4 files changed +16
-20
lines changed Original file line number Diff line number Diff line change @@ -12,8 +12,4 @@ public final class RNMinuteIntervals {
12
12
public static boolean isValid (Integer interval ) {
13
13
return Arrays .asList (MinuteIntervals ).contains (interval );
14
14
}
15
-
16
- public static boolean isRadialPickerCompatible (Integer interval ) {
17
- return MinuteIntervals [0 ].equals (interval ) || MinuteIntervals [1 ].equals (interval );
18
- }
19
15
}
Original file line number Diff line number Diff line change @@ -63,11 +63,7 @@ static TimePickerDialog getDialog(
63
63
64
64
RNTimePickerDisplay display = RNTimePickerDisplay .DEFAULT ;
65
65
if (args != null && args .getString (RNConstants .ARG_DISPLAY , null ) != null ) {
66
- if (RNMinuteIntervals .isRadialPickerCompatible (minuteInterval )) {
67
- display = RNTimePickerDisplay .valueOf (args .getString (RNConstants .ARG_DISPLAY ).toUpperCase (Locale .US ));
68
- } else {
69
- display = RNTimePickerDisplay .SPINNER ;
70
- }
66
+ display = RNTimePickerDisplay .valueOf (args .getString (RNConstants .ARG_DISPLAY ).toUpperCase (Locale .US ));
71
67
}
72
68
73
69
if (args != null ) {
Original file line number Diff line number Diff line change @@ -55,12 +55,18 @@ const App = () => {
55
55
setDisplay ( 'spinner' ) ;
56
56
} ;
57
57
58
- const showTimepickerWithInterval = ( ) => {
58
+ const showTimepickerSpinnerWithInterval = ( ) => {
59
59
showMode ( 'time' ) ;
60
60
setDisplay ( 'spinner' ) ;
61
61
setMinInterval ( 5 ) ;
62
62
} ;
63
63
64
+ const showTimepickerWithInterval = ( ) => {
65
+ showMode ( 'time' ) ;
66
+ setDisplay ( 'default' ) ;
67
+ setMinInterval ( 5 ) ;
68
+ } ;
69
+
64
70
return (
65
71
< >
66
72
< StatusBar barStyle = "dark-content" />
@@ -111,11 +117,18 @@ const App = () => {
111
117
title = "Show time picker!"
112
118
/>
113
119
</ View >
120
+ < View style = { styles . button } >
121
+ < Button
122
+ testID = "timePickerIntervalButton"
123
+ onPress = { showTimepickerSpinnerWithInterval }
124
+ title = "Show time picker spinner (with 5 min interval)!"
125
+ />
126
+ </ View >
114
127
< View style = { styles . button } >
115
128
< Button
116
129
testID = "timePickerIntervalButton"
117
130
onPress = { showTimepickerWithInterval }
118
- title = "Show time picker (with 5 min interval)!"
131
+ title = "Show time picker default (with 5 min interval)!"
119
132
/>
120
133
</ View >
121
134
< View style = { styles . button } >
Original file line number Diff line number Diff line change 8
8
* @flow strict-local
9
9
*/
10
10
import {
11
- DISPLAY_DEFAULT ,
12
- DISPLAY_SPINNER ,
13
11
TIME_SET_ACTION ,
14
12
DISMISS_ACTION ,
15
13
MINUTE_INTERVAL_DEFAULT ,
@@ -19,10 +17,6 @@ import {toMilliseconds} from './utils';
19
17
20
18
import type { TimePickerOptions , DateTimePickerResult } from './types' ;
21
19
22
- const isRadialPickerCompatible = ( interval : number ) => {
23
- return interval === 1 || interval === 5 ;
24
- } ;
25
-
26
20
export default class TimePickerAndroid {
27
21
/**
28
22
* Opens the standard Android time picker dialog.
@@ -46,9 +40,6 @@ export default class TimePickerAndroid {
46
40
static async open ( options : TimePickerOptions ) : Promise < DateTimePickerResult > {
47
41
toMilliseconds ( options , 'value' ) ;
48
42
options . minuteInterval = options . minuteInterval || MINUTE_INTERVAL_DEFAULT ;
49
- options . display = isRadialPickerCompatible ( options . minuteInterval )
50
- ? options . display || DISPLAY_DEFAULT
51
- : DISPLAY_SPINNER ;
52
43
53
44
return NativeModules . RNTimePickerAndroid . open ( options ) ;
54
45
}
You can’t perform that action at this time.
0 commit comments