Let symptom views overwrite isDeleteIconActive method

This commit is contained in:
Julia Friesel
2019-05-17 16:09:49 +02:00
parent b7088c44f2
commit 0f7ab6c803
2 changed files with 17 additions and 4 deletions
@@ -55,6 +55,15 @@ 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 this.state[key] || this.state[key] === 0
})
}
async onBackButtonPress() {
if (typeof this.state.temperature != 'string' || this.state.temperature === '') {
this.deleteSymptomEntry()