Replace getOrCreateCycleDay

This commit is contained in:
Julia Friesel
2018-11-16 14:24:16 +01:00
parent ecca6cfda9
commit bb0a535d65
18 changed files with 255 additions and 309 deletions
+7 -10
View File
@@ -14,14 +14,10 @@ import SymptomSection from './symptom-section'
export default class Cervix extends Component {
constructor(props) {
super(props)
this.cycleDay = props.cycleDay
const cycleDay = props.cycleDay
this.cervix = cycleDay && cycleDay.cervix
this.makeActionButtons = props.makeActionButtons
this.state = {
exclude: this.cycleDay.cervix ? this.cycleDay.cervix.exclude : false,
opening: this.cycleDay.cervix ? this.cycleDay.cervix.opening : null,
firmness: this.cycleDay.cervix ? this.cycleDay.cervix.firmness : null,
position: this.cycleDay.cervix ? this.cycleDay.cervix.position : null
}
this.state = this.cervix ? this.cervix : {}
}
render() {
@@ -87,13 +83,14 @@ export default class Cervix extends Component {
</ScrollView>
<ActionButtonFooter
symptom='cervix'
cycleDay={this.cycleDay}
date={this.props.date}
currentSymptomValue={this.cervix}
saveAction={() => {
saveSymptom('cervix', this.cycleDay, {
saveSymptom('cervix', this.props.date, {
opening: this.state.opening,
firmness: this.state.firmness,
position: this.state.position,
exclude: this.state.exclude
exclude: Boolean(this.state.exclude)
})
}}
saveDisabled={typeof this.state.opening != 'number' || typeof this.state.firmness != 'number'}