Fix action buttons
This commit is contained in:
@@ -5,26 +5,24 @@ import {
|
|||||||
} from 'react-native'
|
} from 'react-native'
|
||||||
import { saveSymptom } from '../../db'
|
import { saveSymptom } from '../../db'
|
||||||
|
|
||||||
const dayView = 'DayView'
|
export default function (navigateToOverView) {
|
||||||
|
|
||||||
export default function (showView) {
|
|
||||||
return function ({ symptom, cycleDay, saveAction, saveDisabled}) {
|
return function ({ symptom, cycleDay, saveAction, saveDisabled}) {
|
||||||
const buttons = [
|
const buttons = [
|
||||||
{
|
{
|
||||||
title: 'Cancel',
|
title: 'Cancel',
|
||||||
action: () => showView(dayView)
|
action: () => navigateToOverView()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Delete',
|
title: 'Delete',
|
||||||
action: () => {
|
action: () => {
|
||||||
saveSymptom(symptom, cycleDay)
|
saveSymptom(symptom, cycleDay)
|
||||||
showView(dayView)
|
navigateToOverView()
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
title: 'Save',
|
title: 'Save',
|
||||||
action: () => {
|
action: () => {
|
||||||
saveAction()
|
saveAction()
|
||||||
showView(dayView)
|
navigateToOverView()
|
||||||
},
|
},
|
||||||
disabledCondition: saveDisabled
|
disabledCondition: saveDisabled
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,10 +38,9 @@ export default class SymptomView extends Component {
|
|||||||
cycleDay: props.navigation.state.params.cycleDay
|
cycleDay: props.navigation.state.params.cycleDay
|
||||||
}
|
}
|
||||||
|
|
||||||
this.showView = view => {
|
this.makeActionButtons = actionButtonModule(() => {
|
||||||
this.setState({visibleComponent: view})
|
this.props.navigation.navigate('CycleDay', {cycleDay: this.state.cycleDay})
|
||||||
}
|
})
|
||||||
this.makeActionButtons = actionButtonModule(this.showView)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|||||||
Reference in New Issue
Block a user