From e634bdcd58a13f92516e8ee40a3c24e773805fc6 Mon Sep 17 00:00:00 2001 From: Der_Googler <54764558+DerGoogler@users.noreply.github.com> Date: Tue, 31 Oct 2023 13:23:59 +0100 Subject: [PATCH] Fix #52 --- Website/src/activitys/TerminalActivity.tsx | 5 ++--- Website/src/components/onsenui/Page.tsx | 2 +- Website/src/typings/global.d.ts | 12 ++++++++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Website/src/activitys/TerminalActivity.tsx b/Website/src/activitys/TerminalActivity.tsx index 320b11f2..fa307a2b 100644 --- a/Website/src/activitys/TerminalActivity.tsx +++ b/Website/src/activitys/TerminalActivity.tsx @@ -103,10 +103,9 @@ const TerminalActivity = () => { return ( { - e.preventDefault(); + onDeviceBackButton={(e) => { if (!active) { - context.popPage(); + e.callParentHandler(); } }} onShow={install} diff --git a/Website/src/components/onsenui/Page.tsx b/Website/src/components/onsenui/Page.tsx index 86b631b4..62ff497d 100644 --- a/Website/src/components/onsenui/Page.tsx +++ b/Website/src/components/onsenui/Page.tsx @@ -24,7 +24,7 @@ interface HTMLPage { onShow?: Function; onHide?: Function; onInfiniteScroll?: Function; - onDeviceBackButton?: Function; + onDeviceBackButton?: (event: DeviceBackButtonEvent) => void; children?: React.ReactNode; statusbarColor?: string; setStatusBarColor?: string; diff --git a/Website/src/typings/global.d.ts b/Website/src/typings/global.d.ts index 9322d240..20534e83 100644 --- a/Website/src/typings/global.d.ts +++ b/Website/src/typings/global.d.ts @@ -196,4 +196,16 @@ declare global { changeBoot?: boolean; mmtReborn?: boolean; } + + // OnsenUI Types + /** + * @extends {Event} + */ + export interface DeviceBackButtonEvent extends Event { + /** + * Runs the handler for the immediate parent that supports device back button. + * @returns {void} + */ + callParentHandler: () => void; + } }