-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
125 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React, { SFC } from 'react'; | ||
import { StyleSheet, Text, View } from 'react-native'; | ||
import { default as SliderRN } from '@react-native-community/slider'; // tslint:disable-line | ||
|
||
interface Props { | ||
min: number; | ||
max: number; | ||
handleSliding: (time: number) => void; | ||
} | ||
|
||
export const Slider: SFC<Props> = ({ min, max, handleSliding }) => ( | ||
<View style={styles.sliderContainer}> | ||
<Text>{min}</Text> | ||
<SliderRN style={styles.slider} minimumValue={min} maximumValue={max} onValueChange={handleSliding} step={1} /> | ||
<Text>{max}</Text> | ||
</View> | ||
); | ||
|
||
const styles = StyleSheet.create({ | ||
sliderContainer: { | ||
flexDirection: 'row', | ||
alignItems: 'center', | ||
justifyContent: 'space-between', | ||
}, | ||
slider: { | ||
width: '80%', | ||
height: 40, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import React, { SFC, useState } from 'react'; | ||
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native'; | ||
|
||
import { Slider } from 'components'; | ||
import { i18n } from 'locale'; | ||
import { palette } from 'styles'; | ||
|
||
interface Props { | ||
min: number; | ||
max: number; | ||
closeModal?: () => void; | ||
onConfirm?: (time: number) => void; | ||
} | ||
|
||
export const TimeSlider: SFC<Props> = ({ min, max, closeModal, onConfirm }) => { | ||
const [timer, setTimer] = useState(1); | ||
const handleSliding = (time: number) => setTimer(time); | ||
const handleConfirmPressed = () => { | ||
if (onConfirm) { | ||
onConfirm(timer); | ||
} | ||
if (closeModal) { | ||
closeModal(); | ||
} | ||
}; | ||
return ( | ||
<> | ||
<Slider min={min} max={max} handleSliding={handleSliding} /> | ||
<Text style={styles.time}>{timer}</Text> | ||
<View style={styles.timeSlider}> | ||
<TouchableOpacity onPress={closeModal}> | ||
<Text>{i18n.t('common:cancel')}</Text> | ||
</TouchableOpacity> | ||
<TouchableOpacity onPress={handleConfirmPressed}> | ||
<Text style={styles.confirmButton}>{i18n.t('common:confirm')}</Text> | ||
</TouchableOpacity> | ||
</View> | ||
</> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
timeSlider: { flexDirection: 'row', alignSelf: 'flex-end' }, | ||
confirmButton: { color: palette.textBody, marginLeft: 8 }, | ||
time: { | ||
alignSelf: 'center', | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters