From 89fe5f188348f72f82f62ba647e15d175abbeeef Mon Sep 17 00:00:00 2001 From: Brent Date: Sun, 26 Feb 2023 22:03:56 -0500 Subject: [PATCH] fixed navigation bug --- Screens/EntryDetails.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Screens/EntryDetails.js b/Screens/EntryDetails.js index 84305c0..57be861 100644 --- a/Screens/EntryDetails.js +++ b/Screens/EntryDetails.js @@ -19,16 +19,20 @@ const FoodDetails = ({route}) => { const UpdateFood = () =>{ food.setServings(servings); - navigation.dispatch(StackActions.pop(2)) - navigation.navigate("Diary") + navigation.reset({ + index: 0, + routes: [{ name: 'Diary' }], + }); } const RemoveFood = () =>{ let index = meal.indexOf(food) meal.splice(index,1) console.log(meal) - navigation.dispatch(StackActions.pop(2)) - navigation.navigate("Diary") + navigation.reset({ + index: 0, + routes: [{ name: 'Diary' }], + }); } return(