Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions src/pages/SystemBars.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import {
IonButton,
IonButtons,
IonContent,
IonHeader,
IonPage,
IonMenuButton,
IonTitle,
IonToolbar,
} from '@ionic/react';
import React from 'react';
import { SystemBars, SystemBarsStyle, SystemBarType } from '@capacitor/core';

const SystemBarsPage: React.FC = () => {
const setSystemBarStyleDefault = async () => {
SystemBars.setStyle({
style: SystemBarsStyle.Default,
});
};

const setSystemBarStyleLight = async () => {
await SystemBars.setStyle({ style: SystemBarsStyle.Light });
};

const setSystemBarStyleDark = async () => {
await SystemBars.setStyle({ style: SystemBarsStyle.Dark });
};

const showSystemBars = async () => {
await SystemBars.show();

Check failure on line 30 in src/pages/SystemBars.tsx

View workflow job for this annotation

GitHub Actions / Build and Test

Expected 1 arguments, but got 0.
};

const hideSystemBars = async () => {
await SystemBars.hide();

Check failure on line 34 in src/pages/SystemBars.tsx

View workflow job for this annotation

GitHub Actions / Build and Test

Expected 1 arguments, but got 0.
};

const hideNavigationBar = async () => {
await SystemBars.hide({
bar: SystemBarType.NavigationBar,
});
};

return (
<IonPage>
<IonHeader>
<IonToolbar>
<IonButtons slot="start">
<IonMenuButton />
</IonButtons>
<IonTitle>System Bars</IonTitle>
</IonToolbar>
</IonHeader>
<IonContent>
<IonButton expand="block" onClick={setSystemBarStyleDefault}>
Change System Bars Style Default
</IonButton>
<IonButton expand="block" onClick={setSystemBarStyleLight}>
Change System Bars Style Light
</IonButton>
<IonButton expand="block" onClick={setSystemBarStyleDark}>
Change System Bars Style Dark
</IonButton>
<IonButton expand="block" onClick={showSystemBars}>
Show System Bars
</IonButton>
<IonButton expand="block" onClick={hideSystemBars}>
Hide System Bars
</IonButton>
<IonButton expand="block" onClick={hideNavigationBar}>
Hide Navigation Bar
</IonButton>
</IonContent>
</IonPage>
);
};

export default SystemBarsPage;
11 changes: 11 additions & 0 deletions src/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import ScreenOrientation from './pages/ScreenOrientation';
import SharePage from './pages/Share';
import SplashScreenPage from './pages/SplashScreen';
import StatusBarPage from './pages/StatusBar';
import SystemBarsPage from './pages/SystemBars';
import Preferences from './pages/Preferences';
import TextZoom from './pages/TextZoom';
import ToastPage from './pages/Toast';
Expand Down Expand Up @@ -265,6 +266,16 @@ const routes: Page[] = [
),
component: StatusBarPage,
},
{
title: 'System Bars',
url: '/system-bars',
icon: (
<span role="img" aria-label="vertical traffic light">
🚦
</span>
),
component: SystemBarsPage,
},
{
title: 'Preferences',
url: '/preferences',
Expand Down
Loading