diff --git a/components/cycle-day/symptoms/action-button-footer.js b/components/cycle-day/symptoms/action-button-footer.js index 37526f3..5dea8ac 100644 --- a/components/cycle-day/symptoms/action-button-footer.js +++ b/components/cycle-day/symptoms/action-button-footer.js @@ -1,8 +1,7 @@ import React, { Component } from 'react' import { - View, TouchableOpacity, Text, Alert} from 'react-native' + View, TouchableOpacity, Text} from 'react-native' import Icon from 'react-native-vector-icons/MaterialCommunityIcons' -import { saveSymptom } from '../../../db' import styles, {iconStyles} from '../../../styles' import {sharedDialogs as labels} from '../../../i18n/en/cycle-day' @@ -10,31 +9,13 @@ import {sharedDialogs as labels} from '../../../i18n/en/cycle-day' export default class ActionButtonFooter extends Component { render() { const { - symptom, currentSymptomValue, - date, - navigate, } = this.props - const navigateToOverView = () => navigate('CycleDay', {date}) const buttons = [ { title: labels.delete, action: () => { - Alert.alert( - labels.areYouSureTitle, - labels.areYouSureToDelete, - [{ - text: labels.cancel, - style: 'cancel' - }, { - text: labels.reallyDeleteData, - onPress: () => { - saveSymptom(symptom, date) - navigateToOverView() - } - }] - ) }, disabledCondition: (!currentSymptomValue || (Object.keys(currentSymptomValue).length === 0 && currentSymptomValue.constructor === Object) || diff --git a/components/cycle-day/symptoms/symptom-view.js b/components/cycle-day/symptoms/symptom-view.js index 9bd7a03..abcd758 100644 --- a/components/cycle-day/symptoms/symptom-view.js +++ b/components/cycle-day/symptoms/symptom-view.js @@ -1,8 +1,9 @@ import React, { Component } from 'react' -import { BackHandler, View } from 'react-native' +import { BackHandler, View, Alert } from 'react-native' import { saveSymptom } from '../../../db' import Header from '../../header/symptom-view' import { headerTitles } from '../../../i18n/en/labels' +import { sharedDialogs } from '../../../i18n/en/cycle-day' export default class SymptomView extends Component { constructor(props) { @@ -41,8 +42,20 @@ export default class SymptomView extends Component { date={this.date} goBack={this.handleBackButtonPressOnSymptomView.bind(this)} deleteEntry={() => { - this.deleteSymptomEntry() - this.globalBackhandler() + Alert.alert( + sharedDialogs.areYouSureTitle, + sharedDialogs.areYouSureToDelete, + [{ + text: sharedDialogs.cancel, + style: 'cancel' + }, { + text: sharedDialogs.reallyDeleteData, + onPress: () => { + this.deleteSymptomEntry() + this.globalBackhandler() + } + }] + ) }} /> {this.renderContent()}