Skip to content

Commit a17c366

Browse files
committed
fix: auto-detect Android view mode on native platform
Initialize viewMode to 'android' when running as native APK via Capacitor.isNativePlatform(). Dev mode on web still defaults to 'web' with toggle available.
1 parent 55e4e62 commit a17c366

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/App.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom'
22
import { useState, useEffect } from 'react'
3+
import { Capacitor } from '@capacitor/core'
34
import { Theme, Tool, ViewMode } from './types'
45
import Layout from './components/Layout'
56
import WebView from './components/WebView'
@@ -59,7 +60,7 @@ const tools: Tool[] = [
5960

6061
export default function App() {
6162
const [theme, setTheme] = useState<Theme>('system')
62-
const [viewMode, setViewMode] = useState<ViewMode>('web')
63+
const [viewMode, setViewMode] = useState<ViewMode>(Capacitor.isNativePlatform() ? 'android' : 'web')
6364

6465
useEffect(() => {
6566
const isDark = theme === 'dark' || (theme === 'system' && window.matchMedia('(prefers-color-scheme: dark)').matches)

0 commit comments

Comments
 (0)