Add symptom view component with back button listener

This commit is contained in:
Julia Friesel
2019-05-11 17:42:57 +02:00
parent 2528c03315
commit 08fd3afc34
11 changed files with 113 additions and 72 deletions
+10 -9
View File
@@ -1,4 +1,4 @@
import React, { Component } from 'react'
import React from 'react'
import {
View,
Switch,
@@ -10,8 +10,9 @@ import { bleeding } from '../../../i18n/en/cycle-day'
import ActionButtonFooter from './action-button-footer'
import SelectTabGroup from '../select-tab-group'
import SymptomSection from './symptom-section'
import SymptomView from './symptom-view'
export default class Bleeding extends Component {
export default class Bleeding extends SymptomView {
constructor(props) {
super(props)
const cycleDay = props.cycleDay
@@ -22,6 +23,13 @@ export default class Bleeding extends Component {
}
}
save() {
saveSymptom('bleeding', this.props.date, {
value: this.state.currentValue,
exclude: this.state.exclude
})
}
render() {
const bleedingRadioProps = [
{ label: bleeding.labels[0], value: 0 },
@@ -59,13 +67,6 @@ export default class Bleeding extends Component {
symptom='bleeding'
date={this.props.date}
currentSymptomValue={this.bleeding}
saveAction={() => {
saveSymptom('bleeding', this.props.date, {
value: this.state.currentValue,
exclude: this.state.exclude
})
}}
saveDisabled={typeof this.state.currentValue != 'number'}
navigate={this.props.navigate}
/>
</View>