From 322b3c00d779d89da01c8da339b9a235a0e83a44 Mon Sep 17 00:00:00 2001
From: Julia Friesel <julia.friesel@gmail.com>
Date: Sat, 18 Aug 2018 16:01:49 +0200
Subject: [PATCH] Fix action buttons

---
 components/cycle-day/action-buttons.js | 10 ++++------
 components/cycle-day/symptoms/index.js |  7 +++----
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/components/cycle-day/action-buttons.js b/components/cycle-day/action-buttons.js
index 78e24793..488b10dc 100644
--- a/components/cycle-day/action-buttons.js
+++ b/components/cycle-day/action-buttons.js
@@ -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
       }
diff --git a/components/cycle-day/symptoms/index.js b/components/cycle-day/symptoms/index.js
index c2c050b6..5b73d857 100644
--- a/components/cycle-day/symptoms/index.js
+++ b/components/cycle-day/symptoms/index.js
@@ -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() {
-- 
GitLab