"use client"; import { useEffect } from "react"; import { handleHardwareBack } from "@/hooks/use-hardware-back-handler"; /** * Wires the React hardware-back handler stack to the global * window.__habibHandleHardwareBack function. * * Mount this once in the Providers tree (after React hydration). * It replaces the bootstrap stub with the real handler that walks * the registered stack. */ export function HardwareBackBridge() { useEffect(() => { window.__habibHandleHardwareBack = handleHardwareBack; return () => { // On unmount (shouldn't happen in practice), restore the stub. window.__habibHandleHardwareBack = () => Promise.resolve({ handled: false }); }; }, []); return null; } export default HardwareBackBridge;