solves the action footer, but messes up the header
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import React, { Component } from 'react'
|
||||
import {
|
||||
View, TouchableOpacity, Text
|
||||
View, TouchableOpacity, Text, Alert
|
||||
} 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 '../labels/labels'
|
||||
|
||||
export default class ActionButtonFooter extends Component {
|
||||
render() {
|
||||
@@ -17,33 +18,29 @@ export default class ActionButtonFooter extends Component {
|
||||
autoShowDayView = true}
|
||||
= this.props
|
||||
const navigateToOverView = () => navigate('CycleDay', {cycleDay})
|
||||
const buttonsNewEntry = [
|
||||
const buttons = [
|
||||
{
|
||||
title: 'Cancel',
|
||||
action: () => navigateToOverView(),
|
||||
icon: 'cancel'
|
||||
},
|
||||
{
|
||||
title: 'Add',
|
||||
title: labels.unset,
|
||||
action: () => {
|
||||
saveAction()
|
||||
if (autoShowDayView) navigateToOverView()
|
||||
},
|
||||
disabledCondition: saveDisabled,
|
||||
icon: 'content-save-outline'
|
||||
}
|
||||
]
|
||||
const buttonsEdit = [
|
||||
{
|
||||
title: 'Delete',
|
||||
action: () => {
|
||||
saveSymptom(symptom, cycleDay)
|
||||
navigateToOverView()
|
||||
Alert.alert(
|
||||
labels.areYouSureTitle,
|
||||
labels.areYouSureToUnset,
|
||||
[{
|
||||
text: labels.cancel,
|
||||
style: 'cancel'
|
||||
}, {
|
||||
text: labels.reallyUnsetData,
|
||||
onPress: () => {
|
||||
saveSymptom(symptom, cycleDay)
|
||||
navigateToOverView()
|
||||
}
|
||||
}]
|
||||
)
|
||||
},
|
||||
disabledCondition: !cycleDay[symptom],
|
||||
icon: 'delete-outline'
|
||||
}, {
|
||||
title: 'Save',
|
||||
title: labels.save,
|
||||
action: () => {
|
||||
saveAction()
|
||||
if (autoShowDayView) navigateToOverView()
|
||||
@@ -52,7 +49,6 @@ export default class ActionButtonFooter extends Component {
|
||||
icon: 'content-save-outline'
|
||||
}
|
||||
]
|
||||
const buttons = !cycleDay[symptom] ? buttonsNewEntry : buttonsEdit
|
||||
|
||||
return (
|
||||
<View style={styles.menu}>
|
||||
|
||||
Reference in New Issue
Block a user