From ced809d3755e239edca080085dbf1f5713a622fd Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Fri, 28 Feb 2025 15:20:54 +0500 Subject: [PATCH] mobile: fix back navigation bug --- apps/mobile/app/components/fluid-panels/index.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/mobile/app/components/fluid-panels/index.tsx b/apps/mobile/app/components/fluid-panels/index.tsx index 556cf029e..bcb137ed8 100644 --- a/apps/mobile/app/components/fluid-panels/index.tsx +++ b/apps/mobile/app/components/fluid-panels/index.tsx @@ -43,6 +43,7 @@ import { eSendEvent } from "../../services/event-manager"; import { useSettingStore } from "../../stores/use-setting-store"; import { eClearEditor } from "../../utils/events"; import { useSideBarDraggingStore } from "../side-menu/dragging-store"; +import { rootNavigatorRef } from "../../utils/global-refs"; interface TabProps extends ViewProps { dimensions: { width: number; height: number }; @@ -145,6 +146,12 @@ export const FluidPanels = forwardRef(function FluidTabs( useEffect(() => { const sub = BackHandler.addEventListener("hardwareBackPress", () => { if (isDrawerOpen.value && !forcedLock.value) { + const routeNames = rootNavigatorRef.current?.getState().routes; + if (routeNames) { + const currentRoute = routeNames[routeNames.length - 1].name; + if (currentRoute !== "FluidPanelsView") return false; + } + translateX.value = withTiming(homePosition); onDrawerStateChange(false); isDrawerOpen.value = false;