Newer
Older
import React, { Component } from 'react'
import {
View,
} from 'react-native'
import styles from '../../../styles'
import { saveSymptom } from '../../../db'
Stefanie Grewenig
committed
import { bleeding } from '../../../i18n/en/cycle-day'
import ActionButtonFooter from './action-button-footer'
import SelectTabGroup from '../select-tab-group'
import SymptomSection from './symptom-section'
export default class Bleeding extends Component {
constructor(props) {
super(props)
const cycleDay = props.cycleDay
this.bleeding = cycleDay && cycleDay.bleeding
this.makeActionButtons = props.makeActionButtons
this.state = {
currentValue: this.bleeding && this.bleeding.value,
exclude: this.bleeding ? this.bleeding.exclude : false
}
}
render() {
const bleedingRadioProps = [
Stefanie Grewenig
committed
{ label: bleeding.labels[0], value: 0 },
{ label: bleeding.labels[1], value: 1 },
{ label: bleeding.labels[2], value: 2 },
{ label: bleeding.labels[3], value: 3 },
<ScrollView style={styles.page}>
Stefanie Grewenig
committed
header={bleeding.heaviness.header}
explainer={bleeding.heaviness.explainer}
buttons={bleedingRadioProps}
active={this.state.currentValue}
onSelect={val => this.setState({ currentValue: val })}
/>
Stefanie Grewenig
committed
header={bleeding.exclude.header}
explainer={bleeding.exclude.explainer}
>
<Switch
onValueChange={(val) => {
this.setState({ exclude: val })
}}
value={this.state.exclude}
/>
</SymptomSection>
<ActionButtonFooter
symptom='bleeding'
date={this.props.date}
currentSymptomValue={this.bleeding}
saveAction={() => {
value: this.state.currentValue,
exclude: this.state.exclude
})
}}
saveDisabled={typeof this.state.currentValue != 'number'}
navigate={this.props.navigate}
/>
</View>
)
}
}