Skip to content
Snippets Groups Projects
Commit c4f68e60 authored by Julia Friesel's avatar Julia Friesel
Browse files

Display persisted bleeding value in edit view

parent 8ee53ba7
No related branches found
No related tags found
No related merge requests found
...@@ -13,9 +13,10 @@ import { bleeding as labels } from './labels' ...@@ -13,9 +13,10 @@ import { bleeding as labels } from './labels'
export default class Bleeding extends Component { export default class Bleeding extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
const cycleDay = props.navigation.state.params.cycleDay
this.state = { this.state = {
cycleDay: props.navigation.state.params.cycleDay, cycleDay,
currentValue: "1" currentValue: Number((cycleDay.bleeding && cycleDay.bleeding.value) || 0).toString()
} }
} }
...@@ -38,6 +39,19 @@ export default class Bleeding extends Component { ...@@ -38,6 +39,19 @@ export default class Bleeding extends Component {
<Picker.Item label={labels[2]} value="2" /> <Picker.Item label={labels[2]} value="2" />
<Picker.Item label={labels[3]} value="3" /> <Picker.Item label={labels[3]} value="3" />
</Picker> </Picker>
<Button
onPress={() => {
navigate('dayView', { cycleDay: day })
}}
title="Cancel">
</Button>
<Button
onPress={() => {
saveBleeding(day)
navigate('dayView', { cycleDay: day })
}}
title="Delete entry">
</Button>
<Button <Button
onPress={() => { onPress={() => {
saveBleeding(day, { saveBleeding(day, {
......
...@@ -23,7 +23,7 @@ export default class DayView extends Component { ...@@ -23,7 +23,7 @@ export default class DayView extends Component {
return ( return (
<View style={styles.container}> <View style={styles.container}>
<Text style={styles.welcome}>{formatDateForViewHeader(day.date)}</Text> <Text style={styles.welcome}>{formatDateForViewHeader(day.date)}</Text>
<Text style={styles.welcome}>{bleedingValue != undefined ? labels[bleedingValue] : ''}</Text> <Text style={styles.welcome}>{typeof bleedingValue === 'number' ? labels[bleedingValue] : ''}</Text>
<Button <Button
onPress={() => navigate('bleeding', { cycleDay: day })} onPress={() => navigate('bleeding', { cycleDay: day })}
title="Edit bleeding"> title="Edit bleeding">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment