From bb27cb09832009ad56b69392f5901a97e987bfe8 Mon Sep 17 00:00:00 2001 From: emelko Date: Wed, 4 Jul 2018 13:58:16 +0200 Subject: [PATCH] Add disabled to check for feeling AND texture to be selected; needs state --- components/mucus.js | 155 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 components/mucus.js diff --git a/components/mucus.js b/components/mucus.js new file mode 100644 index 0000000..f2d643d --- /dev/null +++ b/components/mucus.js @@ -0,0 +1,155 @@ +import React, { Component } from 'react' +import { + View, + Button, + Text, + Switch +} from 'react-native' +import RadioForm from 'react-native-simple-radio-button' +import { saveMucus } from '../db' +import styles from '../styles/index' +import { + mucusFeeling as feelingLabels, + mucusTexture as textureLabels +} from '../labels/labels' + +export default class Mucus extends Component { + constructor(props) { + super(props) + this.cycleDay = props.cycleDay + this.showView = props.showView + + let currentFeelingValue = this.cycleDay.mucus && this.cycleDay.mucus.feeling + if (typeof currentFeelingValue !== 'number') { + currentFeelingValue = -1 + } + let currentTextureValue = this.cycleDay.mucus && this.cycleDay.mucus.texture + if (typeof currentTextureValue !== 'number') { + currentTextureValue = -1 + } + + this.state = { + currentFeelingValue, + currentTextureValue, + exclude: this.cycleDay.mucus ? this.cycleDay.mucus.exclude : false + } + + } + + render() { + const mucusFeelingRadioProps = [ + {label: feelingLabels[0], value: 0 }, + {label: feelingLabels[1], value: 1 }, + {label: feelingLabels[2], value: 2 }, + {label: feelingLabels[3], value: 3 } + ] + const mucusTextureRadioProps = [ + {label: textureLabels[0], value: 0 }, + {label: textureLabels[1], value: 1 }, + {label: textureLabels[2], value: 2 } + ] + return( + + + + + + Mucus + + + + Feeling + + + + { + this.setState({currentFeelingValue: itemValue}) + }} + /> + + + + Color/Texture + + + + { + this.setState({currentTextureValue: itemValue}) + }} + /> + + + + + + + + Exclude + + + + { + this.setState({exclude: val}) + }} + value={this.state.exclude} + /> + + + + + + + + + + + + + + + + + + + + + + + + ) + } +}