import React, { Component } from 'react' import { View, Switch, ScrollView } from 'react-native' import styles from '../../../styles' import { saveSymptom } from '../../../db' import { cervix as labels } from '../labels' import ActionButtonFooter from './action-button-footer' import SelectTabGroup from '../select-tab-group' import SymptomSection from './symptom-section' export default class Cervix extends Component { constructor(props) { super(props) this.cycleDay = props.cycleDay 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 } } render() { const cervixOpeningRadioProps = [ { label: labels.opening.categories[0], value: 0 }, { label: labels.opening.categories[1], value: 1 }, { label: labels.opening.categories[2], value: 2 } ] const cervixFirmnessRadioProps = [ { label: labels.firmness.categories[0], value: 0 }, { label: labels.firmness.categories[1], value: 1 } ] const cervixPositionRadioProps = [ { label: labels.position.categories[0], value: 0 }, { label: labels.position.categories[1], value: 1 }, { label: labels.position.categories[2], value: 2 } ] return ( this.setState({ opening: val })} /> this.setState({ firmness: val })} /> this.setState({ position: val })} /> { this.setState({ exclude: val }) }} value={this.state.exclude} /> { saveSymptom('cervix', this.cycleDay, { opening: this.state.opening, firmness: this.state.firmness, position: this.state.position, exclude: this.state.exclude }) }} saveDisabled={typeof this.state.opening != 'number' || typeof this.state.firmness != 'number'} navigate={this.props.navigate} /> ) } }