From d2a452e3c950aa7490ce6a9199a950d5c1eaa2b3 Mon Sep 17 00:00:00 2001 From: MariaZ Date: Sun, 29 Aug 2021 14:08:37 +0200 Subject: [PATCH] Add toast to saving/deleting symptom data --- components/cycle-day/symptom-edit-view.js | 18 ++++++++++++++---- i18n/en/labels.js | 2 ++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/components/cycle-day/symptom-edit-view.js b/components/cycle-day/symptom-edit-view.js index a6e0de9..b7e4a03 100644 --- a/components/cycle-day/symptom-edit-view.js +++ b/components/cycle-day/symptom-edit-view.js @@ -1,6 +1,7 @@ import React, { Component } from 'react' import PropTypes from 'prop-types' import { Dimensions, ScrollView, StyleSheet, View } from 'react-native' +import { connect } from 'react-redux' import AppModal from '../common/app-modal' import AppSwitch from '../common/app-switch' @@ -13,9 +14,9 @@ import SelectBoxGroup from './select-box-group' import SelectTabGroup from './select-tab-group' import Temperature from './temperature' -import { connect } from 'react-redux' import { getDate } from '../../slices/date' import { blank, save, shouldShow, symtomPage } from '../helpers/cycle-day' +import { showToast } from '../helpers/general' import { shared as sharedLabels } from '../../i18n/en/labels' import info from '../../i18n/en/symptom-info' @@ -84,11 +85,13 @@ class SymptomEditView extends Component { onRemove = () => { this.saveData(true) + showToast(sharedLabels.dataDeleted) this.props.onClose() } onSave = () => { this.saveData() + showToast(sharedLabels.dataSaved) this.props.onClose() } @@ -135,8 +138,15 @@ class SymptomEditView extends Component { save[symptom](data, date, shouldDeleteData) } + closeView = () => { + const { onClose } = this.props + + showToast(sharedLabels.dataSaved) + onClose() + } + render() { - const { onClose, symptom } = this.props + const { symptom } = this.props const { data, shouldShowExclude, shouldShowInfo, @@ -148,13 +158,13 @@ class SymptomEditView extends Component { const noteText = symptom === 'note' ? data.value : data.note return ( - + - + {symptom === 'temperature' &&