From 8357d61170744838ee4351809fb8451bd462f8f4 Mon Sep 17 00:00:00 2001 From: tina Date: Fri, 21 Sep 2018 18:20:02 +0200 Subject: [PATCH] reduces footer actions to save, leaving no possibility to delete data once it was saved --- .../symptoms/action-button-footer.js | 68 +++++++------------ components/cycle-day/symptoms/bleeding.js | 1 - 2 files changed, 23 insertions(+), 46 deletions(-) diff --git a/components/cycle-day/symptoms/action-button-footer.js b/components/cycle-day/symptoms/action-button-footer.js index dac39a6..ea96f94 100644 --- a/components/cycle-day/symptoms/action-button-footer.js +++ b/components/cycle-day/symptoms/action-button-footer.js @@ -3,13 +3,11 @@ import { View, TouchableOpacity, Text } from 'react-native' import Icon from 'react-native-vector-icons/MaterialCommunityIcons' -import { saveSymptom } from '../../../db' import styles, {iconStyles} from '../../../styles' export default class ActionButtonFooter extends Component { render() { const { - symptom, cycleDay, saveAction, saveDisabled, @@ -17,53 +15,33 @@ export default class ActionButtonFooter extends Component { autoShowDayView = true} = this.props const navigateToOverView = () => navigate('CycleDay', {cycleDay}) - const buttons = [ - { - title: 'Cancel', - action: () => navigateToOverView(), - icon: 'cancel' + const saveButton = { + title: 'Save', + action: () => { + saveAction() + if (autoShowDayView) navigateToOverView() }, - { - title: 'Delete', - action: () => { - saveSymptom(symptom, cycleDay) - navigateToOverView() - }, - disabledCondition: !cycleDay[symptom], - icon: 'delete-outline' - }, { - title: 'Save', - action: () => { - saveAction() - if (autoShowDayView) navigateToOverView() - }, - disabledCondition: saveDisabled, - icon: 'content-save-outline' - } - ] + disabledCondition: saveDisabled, + icon: 'content-save-outline' + } + const textStyle = saveButton.disabledCondition ? styles.menuTextInActive : styles.menuText + const iconStyle = saveButton.disabledCondition ? + Object.assign({}, iconStyles.menuIcon, iconStyles.menuIconInactive) : + iconStyles.menuIcon return ( - {buttons.map(({ title, action, disabledCondition, icon }, i) => { - const textStyle = disabledCondition ? styles.menuTextInActive : styles.menuText - const iconStyle = disabledCondition ? - Object.assign({}, iconStyles.menuIcon, iconStyles.menuIconInactive) : - iconStyles.menuIcon - - return ( - - - - {title} - - - ) - })} + + + + {saveButton.title} + + ) } diff --git a/components/cycle-day/symptoms/bleeding.js b/components/cycle-day/symptoms/bleeding.js index 3c88ec5..6357c26 100644 --- a/components/cycle-day/symptoms/bleeding.js +++ b/components/cycle-day/symptoms/bleeding.js @@ -56,7 +56,6 @@ export default class Bleeding extends Component { { saveSymptom('bleeding', this.props.cycleDay, {