Skip to content

Commit

Permalink
add minute interval on example app
Browse files Browse the repository at this point in the history
  • Loading branch information
luancurti committed May 21, 2020
1 parent e9854e0 commit 943796b
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions example/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const App = () => {
const [show, setShow] = useState(false);
const [color, setColor] = useState();
const [display, setDisplay] = useState('default');
const [interval, setMinInterval] = useState(undefined);

// Windows-specific
const [maxDate, setMinDate] = useState(new Date('2021'));
Expand All @@ -46,6 +47,7 @@ export const App = () => {
const showMode = currentMode => {
setShow(true);
setMode(currentMode);
setMinInterval(undefined);
};

const showDatepicker = () => {
Expand All @@ -68,6 +70,18 @@ export const App = () => {
setDisplay('spinner');
};

const showTimepickerDefaultWithInterval = () => {
showMode('time');
setDisplay('default');
setMinInterval(5);
};

const showTimepickerSpinnerWithInterval = () => {
showMode('time');
setDisplay('spinner');
setMinInterval(5);
};

if (Platform.OS !== 'windows') {
return (
<>
Expand Down Expand Up @@ -130,6 +144,20 @@ export const App = () => {
title="Show time picker spinner!"
/>
</View>
<View style={styles.button}>
<Button
testID="timePickerIntervalButton"
onPress={showTimepickerDefaultWithInterval}
title="Show time picker default (with 5 min interval)!"
/>
</View>
<View style={styles.button}>
<Button
testID="timePickerIntervalButton"
onPress={showTimepickerSpinnerWithInterval}
title="Show time picker spinner (with 5 min interval)!"
/>
</View>
<View style={styles.header}>
<Text testID="dateTimeText" style={styles.dateTimeText}>
{mode === 'time' && moment.utc(date).format('HH:mm')}
Expand Down

0 comments on commit 943796b

Please sign in to comment.