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

Fix action buttons

parent a7549814
No related branches found
No related tags found
No related merge requests found
......@@ -5,26 +5,24 @@ import {
} from 'react-native'
import { saveSymptom } from '../../db'
const dayView = 'DayView'
export default function (showView) {
export default function (navigateToOverView) {
return function ({ symptom, cycleDay, saveAction, saveDisabled}) {
const buttons = [
{
title: 'Cancel',
action: () => showView(dayView)
action: () => navigateToOverView()
},
{
title: 'Delete',
action: () => {
saveSymptom(symptom, cycleDay)
showView(dayView)
navigateToOverView()
}
}, {
title: 'Save',
action: () => {
saveAction()
showView(dayView)
navigateToOverView()
},
disabledCondition: saveDisabled
}
......
......@@ -38,10 +38,9 @@ export default class SymptomView extends Component {
cycleDay: props.navigation.state.params.cycleDay
}
this.showView = view => {
this.setState({visibleComponent: view})
}
this.makeActionButtons = actionButtonModule(this.showView)
this.makeActionButtons = actionButtonModule(() => {
this.props.navigation.navigate('CycleDay', {cycleDay: this.state.cycleDay})
})
}
render() {
......
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