Make time field visible for new temps also
This commit is contained in:
@@ -17,9 +17,11 @@ export default class Temp extends Component {
|
|||||||
this.makeActionButtons = props.makeActionButtons
|
this.makeActionButtons = props.makeActionButtons
|
||||||
let initialValue
|
let initialValue
|
||||||
|
|
||||||
if (this.cycleDay.temperature) {
|
const temp = this.cycleDay.temperature
|
||||||
initialValue = this.cycleDay.temperature.value.toString()
|
|
||||||
this.time = this.cycleDay.temperature.time
|
if (temp) {
|
||||||
|
initialValue = temp.value.toString()
|
||||||
|
this.time = temp.time
|
||||||
} else {
|
} else {
|
||||||
const prevTemp = getPreviousTemperature(this.cycleDay)
|
const prevTemp = getPreviousTemperature(this.cycleDay)
|
||||||
initialValue = prevTemp ? prevTemp.toString() : ''
|
initialValue = prevTemp ? prevTemp.toString() : ''
|
||||||
@@ -27,8 +29,8 @@ export default class Temp extends Component {
|
|||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
currentValue: initialValue,
|
currentValue: initialValue,
|
||||||
exclude: this.cycleDay.temperature ? this.cycleDay.temperature.exclude : false,
|
exclude: temp ? temp.exclude : false,
|
||||||
time: this.cycleDay.temperature ? this.cycleDay.temperature.time : null
|
time: this.time || LocalTime.now().truncatedTo(ChronoUnit.MINUTES).toString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,7 +50,7 @@ export default class Temp extends Component {
|
|||||||
value={this.state.currentValue}
|
value={this.state.currentValue}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<View style={styles.symptomViewRowInline} display={this.state.time ? 'flex' : 'none'}>
|
<View style={styles.symptomViewRowInline}>
|
||||||
<Text style={styles.symptomDayView}>Time</Text>
|
<Text style={styles.symptomDayView}>Time</Text>
|
||||||
<TextInput
|
<TextInput
|
||||||
style={styles.temperatureTextInput}
|
style={styles.temperatureTextInput}
|
||||||
@@ -76,8 +78,7 @@ export default class Temp extends Component {
|
|||||||
const dataToSave = {
|
const dataToSave = {
|
||||||
value: Number(this.state.currentValue),
|
value: Number(this.state.currentValue),
|
||||||
exclude: this.state.exclude,
|
exclude: this.state.exclude,
|
||||||
time: this.state.time ||
|
time: this.state.time
|
||||||
LocalTime.now().truncatedTo(ChronoUnit.MINUTES).toString()
|
|
||||||
}
|
}
|
||||||
if (!cycleDay.temperature || cycleDay.temperature && !cycleDay.temperature.time) {
|
if (!cycleDay.temperature || cycleDay.temperature && !cycleDay.temperature.time) {
|
||||||
const now = LocalTime.now().truncatedTo(ChronoUnit.MINUTES).toString()
|
const now = LocalTime.now().truncatedTo(ChronoUnit.MINUTES).toString()
|
||||||
|
|||||||
Reference in New Issue
Block a user