Skip to content

Commit

Permalink
Fix #52
Browse files Browse the repository at this point in the history
  • Loading branch information
DerGoogler committed Oct 31, 2023
1 parent 6877b5a commit e634bdc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
5 changes: 2 additions & 3 deletions Website/src/activitys/TerminalActivity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,9 @@ const TerminalActivity = () => {

return (
<Page
onDeviceBackButton={(e: Event) => {
e.preventDefault();
onDeviceBackButton={(e) => {
if (!active) {
context.popPage();
e.callParentHandler();
}
}}
onShow={install}
Expand Down
2 changes: 1 addition & 1 deletion Website/src/components/onsenui/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 12 additions & 0 deletions Website/src/typings/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

0 comments on commit e634bdc

Please sign in to comment.