Make saving incomplete value possible
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import React, { Component } from 'react'
|
||||
import {
|
||||
View, TouchableOpacity, Text, Alert, ToastAndroid
|
||||
} from 'react-native'
|
||||
View, TouchableOpacity, Text, Alert} from 'react-native'
|
||||
import Icon from 'react-native-vector-icons/MaterialCommunityIcons'
|
||||
import { saveSymptom } from '../../../db'
|
||||
import styles, {iconStyles} from '../../../styles'
|
||||
@@ -15,7 +14,6 @@ export default class ActionButtonFooter extends Component {
|
||||
currentSymptomValue,
|
||||
date,
|
||||
saveAction,
|
||||
saveDisabled,
|
||||
navigate,
|
||||
autoShowDayView = true}
|
||||
= this.props
|
||||
@@ -47,40 +45,24 @@ export default class ActionButtonFooter extends Component {
|
||||
}, {
|
||||
title: labels.save,
|
||||
action: () => {
|
||||
if(saveDisabled) {
|
||||
ToastAndroid.show(labels.disabledInfo, ToastAndroid.LONG)
|
||||
} else {
|
||||
saveAction()
|
||||
if (autoShowDayView) navigateToOverView()
|
||||
}
|
||||
saveAction()
|
||||
if (autoShowDayView) navigateToOverView()
|
||||
|
||||
},
|
||||
disabledCondition: saveDisabled,
|
||||
icon: 'content-save-outline'
|
||||
}
|
||||
]
|
||||
return (
|
||||
<View style={styles.actionButtonFooter}>
|
||||
{buttons.map(({ title, action, disabledCondition, icon }, i) => {
|
||||
<View style={styles.menu}>
|
||||
{buttons.map(({ title, action, icon }, i) => {
|
||||
const textStyle = [styles.menuText]
|
||||
if (disabledCondition) {
|
||||
textStyle.push(styles.menuTextInActive)
|
||||
}
|
||||
const iconStyle = disabledCondition ?
|
||||
Object.assign(
|
||||
{},
|
||||
iconStyles.menuIcon,
|
||||
iconStyles.menuIconInactive
|
||||
)
|
||||
:
|
||||
iconStyles.menuIcon
|
||||
return (
|
||||
<TouchableOpacity
|
||||
onPress={action}
|
||||
style={styles.actionButtonItem}
|
||||
key={i.toString()}
|
||||
>
|
||||
<Icon name={icon} {...iconStyle} />
|
||||
<Icon name={icon} {...iconStyles.menuIcon} />
|
||||
<Text style={textStyle}>
|
||||
{title.toLowerCase()}
|
||||
</Text>
|
||||
|
||||
Reference in New Issue
Block a user