For temperature, only show delete button when certain fields active
This commit is contained in:
@@ -47,7 +47,7 @@ export default class Temp extends SymptomView {
|
||||
} else {
|
||||
const prevTemp = getPreviousTemperature(props.date)
|
||||
if (prevTemp) {
|
||||
this.state.temperature = prevTemp.toString()
|
||||
this.state.suggestedTemperature = prevTemp.toString()
|
||||
this.state.isSuggestion = true
|
||||
}
|
||||
}
|
||||
@@ -56,10 +56,9 @@ export default class Temp extends SymptomView {
|
||||
symptomName = 'temperature'
|
||||
|
||||
isDeleteIconActive() {
|
||||
return Object.keys(this.state).some(key => {
|
||||
// the time is always prefilled, so it's not relevant for setting
|
||||
// the delete button active
|
||||
if (key === 'time') return
|
||||
return ['temperature', 'note', 'exclude'].some(key => {
|
||||
// the time is always and the suggested temp sometimes prefilled, so they're not relevant for setting
|
||||
// the delete button active.
|
||||
return this.state[key] || this.state[key] === 0
|
||||
})
|
||||
}
|
||||
@@ -151,8 +150,7 @@ export default class Temp extends SymptomView {
|
||||
<AppTextInput
|
||||
style={[inputStyle]}
|
||||
autoFocus={true}
|
||||
placeholder={this.state.temperature}
|
||||
value={this.state.temperature}
|
||||
value={this.state.temperature || this.state.suggestedTemperature}
|
||||
onChangeText={this.setTemperature}
|
||||
keyboardType='numeric'
|
||||
maxLength={5}
|
||||
|
||||
Reference in New Issue
Block a user