export interface BackHandlerSubscription { remove(): void; } /** * Hardware back button + app-level back UX. * * Android-only. The native side hooks into `MainActivity.onBackPressed` and * dispatches into `BackHandlerState`, whose registered subscribers each call * `lynx.sendGlobalEvent('hardwareBackPress', ...)`. JS subscribers receive * the event via `GlobalEventEmitter` and decide whether to handle it * (typically: pop a navigator) or escalate to `exitApp()`. * * iOS doesn't have a hardware back button, so `addEventListener` is a no-op * (the listener never fires) and `exitApp()` is a no-op too — App Store * Review Guidelines explicitly forbid programmatic app termination on iOS. * * @example * ```ts * import { BackHandler } from '@sigx/lynx-linking'; * * const sub = BackHandler.addEventListener(() => { * if (router.canGoBack) { router.pop(); return true; } * return false; // not handled — let exitApp escalation happen * }); * * // At the root, if no listener handles, fall back to exiting: * BackHandler.exitApp(); * * // Cleanup on unmount: * sub.remove(); * ``` */ export declare const BackHandler: { /** * Subscribe to hardware-back-press events. Listener returns `true` to * indicate the press was handled (so subsequent listeners can skip it). * Currently the return value is informational only — native always treats * the press as consumed when at least one subscriber is registered. */ readonly addEventListener: (listener: () => boolean | void) => BackHandlerSubscription; /** * Send the foreground task to the back of the activity stack on Android * (the standard "back-out at root" behavior — keeps the bundle warm for * instant resume). On iOS this rejects with an error since iOS doesn't * permit programmatic termination. */ readonly exitApp: () => Promise; }; //# sourceMappingURL=back-handler.d.ts.map