diff --git a/components/cycle-day/symptoms/temperature.js b/components/cycle-day/symptoms/temperature.js index 694c8b3..11961a9 100644 --- a/components/cycle-day/symptoms/temperature.js +++ b/components/cycle-day/symptoms/temperature.js @@ -3,8 +3,10 @@ import { View, Text, TextInput, - Switch + Switch, + Keyboard } from 'react-native' +import DateTimePicker from 'react-native-modal-datetime-picker-nevo' import { getPreviousTemperature, saveSymptom } from '../../../db' import styles from '../../../styles' @@ -30,7 +32,8 @@ export default class Temp extends Component { this.state = { currentValue: initialValue, exclude: temp ? temp.exclude : false, - time: this.time || LocalTime.now().truncatedTo(ChronoUnit.MINUTES).toString() + time: this.time || LocalTime.now().truncatedTo(ChronoUnit.MINUTES).toString(), + isTimePickerVisible: false } } @@ -54,13 +57,24 @@ export default class Temp extends Component { Time { - this.setState({ time: val }) + onFocus={() => { + Keyboard.dismiss() + this.setState({isTimePickerVisible: true}) }} - keyboardType='numeric' value={this.state.time} /> + { + this.setState({ + time: `${jsDate.getHours()}:${jsDate.getMinutes()}`, + isTimePickerVisible: false + }) + }} + onCancel={() => this.setState({isTimePickerVisible: false})} + /> Exclude