Adding "other" as pain option and link text input to it

This commit is contained in:
Bl00dyMarie
2018-08-20 14:55:58 +02:00
parent 30752a05c2
commit e68b8f5460
5 changed files with 36 additions and 7 deletions
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -171,7 +171,7 @@ function getLabel(symptomName, symptom) {
let painLabel = '' let painLabel = ''
if (pain.cramps || pain.ovulationPain || pain.headache || if (pain.cramps || pain.ovulationPain || pain.headache ||
pain.backache || pain.nausea || pain.tenderBreasts || pain.backache || pain.nausea || pain.tenderBreasts ||
pain.migraine pain.migraine || pain.other
) { ) {
painLabel += 'Pain' painLabel += 'Pain'
} }
+2 -1
View File
@@ -27,7 +27,8 @@ export const pain = {
backache: 'Backache', backache: 'Backache',
nausea: 'Nausea', nausea: 'Nausea',
tenderBreasts: 'Tender breasts', tenderBreasts: 'Tender breasts',
migraine: 'Migraine' migraine: 'Migraine',
other: 'Other'
} }
export const fertilityStatus = { export const fertilityStatus = {
+26
View File
@@ -2,6 +2,7 @@ import React, { Component } from 'react'
import { import {
CheckBox, CheckBox,
Text, Text,
TextInput,
View View
} from 'react-native' } from 'react-native'
import styles from '../../../styles' import styles from '../../../styles'
@@ -91,6 +92,31 @@ export default class Pain extends Component {
this.setState({migraine: val}) this.setState({migraine: val})
}} }}
/> />
<Text style={styles.symptomDayView}>
{painLabels.other}
</Text>
<CheckBox
value={this.state.other}
onValueChange={(val) => {
this.setState({
other: val,
focusTextArea: true
})
}}
/>
</View>
<View style={styles.symptomViewRowInline}>
{ this.state.other &&
<TextInput
autoFocus={this.state.focusTextArea}
multiline={true}
placeholder="Enter"
value={this.state.note}
onChangeText={(val) => {
this.setState({note: val})
}}
/>
}
</View> </View>
<View style={styles.actionButtonRow}> <View style={styles.actionButtonRow}>
{this.props.makeActionButtons( {this.props.makeActionButtons(
+3 -1
View File
@@ -84,7 +84,9 @@ const PainSchema = {
headache: { type: 'bool', optional: true }, headache: { type: 'bool', optional: true },
backache: { type: 'bool', optional: true }, backache: { type: 'bool', optional: true },
nausea: { type: 'bool', optional: true }, nausea: { type: 'bool', optional: true },
tenderBreasts: { type: 'bool', optional: true } tenderBreasts: { type: 'bool', optional: true },
other: { type: 'bool', optional: true },
note: { type: 'string', optional: true }
} }
} }