Replace action button footer in remaining symptom views

This commit is contained in:
Julia Friesel
2018-08-20 13:44:05 +02:00
parent d897c3b89f
commit 8629fd5369
10 changed files with 375 additions and 394 deletions
+25 -25
View File
@@ -7,6 +7,7 @@ import RadioForm from 'react-native-simple-radio-button'
import styles from '../../../styles'
import { saveSymptom } from '../../../db'
import { intensity as labels } from '../labels/labels'
import ActionButtonFooter from './action-button-footer'
export default class Desire extends Component {
constructor(props) {
@@ -27,32 +28,31 @@ export default class Desire extends Component {
{ label: labels[2], value: 2 }
]
return (
<View style={styles.symptomEditView}>
<Text style={styles.symptomDayView}>Desire</Text>
<View style={styles.radioButtonRow}>
<RadioForm
radio_props={desireRadioProps}
initial={this.state.currentValue}
formHorizontal={true}
labelHorizontal={false}
labelStyle={styles.radioButton}
onPress={(itemValue) => {
this.setState({ currentValue: itemValue })
}}
/>
</View>
<View style={styles.actionButtonRow}>
{this.makeActionButtons(
{
symptom: 'desire',
cycleDay: this.cycleDay,
saveAction: () => {
saveSymptom('desire', this.cycleDay, { value: this.state.currentValue })
},
saveDisabled: this.state.currentValue === -1
}
)}
<View style={styles.menuOnBottom}>
<View>
<Text style={styles.symptomDayView}>Desire</Text>
<View style={styles.radioButtonRow}>
<RadioForm
radio_props={desireRadioProps}
initial={this.state.currentValue}
formHorizontal={true}
labelHorizontal={false}
labelStyle={styles.radioButton}
onPress={(itemValue) => {
this.setState({ currentValue: itemValue })
}}
/>
</View>
</View>
<ActionButtonFooter
symptom='desire'
cycleDay={this.cycleDay}
saveAction={() => {
saveSymptom('desire', this.cycleDay, { value: this.state.currentValue })
}}
saveDisabled={this.state.currentValue === -1}
navigate={this.props.navigate}
/>
</View>
)
}