You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
770 B
28 lines
770 B
"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;
|