From 8dc743772aa79d5d24be6fae806d969f304b28d7 Mon Sep 17 00:00:00 2001 From: G Date: Fri, 24 May 2024 11:27:18 +0000 Subject: [PATCH] update type and handling of goBack icon. Upon click go to the root of the bottomTabs 'screen with payment options' while resetting the history. --- src/screens/PaymentResultScreen.tsx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/screens/PaymentResultScreen.tsx b/src/screens/PaymentResultScreen.tsx index 842ac46..710b95c 100644 --- a/src/screens/PaymentResultScreen.tsx +++ b/src/screens/PaymentResultScreen.tsx @@ -1,4 +1,4 @@ -import type { PaymentStackScreenComponentProps } from "@/navigations/Types"; +import type { MainStackScreenComponentProps } from "@/navigations/Types"; import BeasyLogoIcon from "@components/BeasyLogoIcon"; import Button from "@components/Button"; import GoBackIconButton from "@components/GoBackIconButton"; @@ -6,12 +6,13 @@ import BackgroundDefault from "@components/backgrounds/BackgroundDefault"; import Box from "@components/bases/Box"; import Text from "@components/bases/Text"; import { LOG } from "@logger"; +import { CommonActions } from "@react-navigation/native"; // import { Text } from "react-native"; import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context"; const log = LOG.extend("PaymentResultScreen"); -const PaymentResultScreen: PaymentStackScreenComponentProps<"paymentResultScreen"> = ({ +const PaymentResultScreen: MainStackScreenComponentProps<"paymentResultScreen"> = ({ route, navigation, }) => { @@ -35,7 +36,16 @@ const PaymentResultScreen: PaymentStackScreenComponentProps<"paymentResultScreen mb={"m"} > - navigation.goBack()} /> + { + navigation.dispatch( + CommonActions.reset({ + index: 1, + routes: [{ name: "appBottomTabsNavigator" }], + }), + ); + }} + />