mobile: fix back navigation bug

This commit is contained in:
Ammar Ahmed
2025-02-28 15:20:54 +05:00
committed by Abdullah Atta
parent 18cc3d3dd5
commit ced809d375

View File

@@ -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<TabsRef, TabProps>(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;