mirror of
https://github.com/plebbit/seedit.git
synced 2026-02-15 16:31:24 -05:00
refactor: add android back button
This commit is contained in:
@@ -5,6 +5,7 @@ import { HashRouter as Router } from 'react-router-dom';
|
||||
import './lib/init-translations';
|
||||
import './index.css';
|
||||
import './themes.css';
|
||||
import { App as CapacitorApp } from '@capacitor/app';
|
||||
|
||||
const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
|
||||
root.render(
|
||||
@@ -14,3 +15,12 @@ root.render(
|
||||
</Router>
|
||||
</React.StrictMode>,
|
||||
);
|
||||
|
||||
// add back button in android app
|
||||
CapacitorApp.addListener('backButton', ({ canGoBack }) => {
|
||||
if (canGoBack) {
|
||||
window.history.back();
|
||||
} else {
|
||||
CapacitorApp.exitApp();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user