浏览代码

Update component/reservationLocationPage/reservationLocationPage.tsx

Co-authored-by: MGTKenYCS <108712278+MGTKenYCS@users.noreply.github.com>
Ian Fung 1 年之前
父节点
当前提交
a071aed657
共有 1 个文件被更改,包括 9 次插入1 次删除
  1. 9 1
      component/reservationLocationPage/reservationLocationPage.tsx

+ 9 - 1
component/reservationLocationPage/reservationLocationPage.tsx

@@ -276,7 +276,15 @@ const ReservationLocationPage = () => {
                         <View className="pt-6 ">
                             {/* For now, clicking the X button goes back to login page. */}
                             {/* Once home page component is created, i will change it */}
-                            <Pressable onPress={() => router.push('/')}>
+                            <Pressable
+                                onPress={() => {
+                                    if (router.canGoBack()) {
+                                        router.back();
+                                    } else {
+                                        router.replace('/');
+                                    }
+                                }}
+                            >
                                 <CrossLogoSvg />
                             </Pressable>
                         </View>