From 18aeee6aac40702c2d86cf976a9a67c5691505cf Mon Sep 17 00:00:00 2001 From: Tyler McGinnis Date: Wed, 30 Aug 2017 15:23:03 -0600 Subject: [PATCH] Changes for finish-navigation --- components/AddEntry.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/AddEntry.js b/components/AddEntry.js index 5cb31e08..85a48fc1 100644 --- a/components/AddEntry.js +++ b/components/AddEntry.js @@ -14,6 +14,7 @@ import { submitEntry, removeEntry } from '../utils/api' import { connect } from 'react-redux' import { addEntry } from '../actions' import { purple, white } from '../utils/colors' +import { NavigationActions } from 'react-navigation' function SubmitBtn ({ onPress }) { return ( @@ -69,7 +70,7 @@ class AddEntry extends Component { this.setState(() => ({ run: 0, bike: 0, swim: 0, sleep: 0, eat: 0 })) - // Navigate to home + this.toHome() submitEntry({ key, entry }) @@ -82,10 +83,13 @@ class AddEntry extends Component { [key]: getDailyReminderValue() })) - // Route to Home + this.toHome() removeEntry(key) } + toHome = () => { + this.props.navigation.dispatch(NavigationActions.back({key: 'AddEntry'})) + } render() { const metaInfo = getMetricMetaInfo()