RotNot / src /components /capacitor-init.tsx
deploy
Deploy RotNot
9580dce
Raw History Blame Contribute Delete
626 Bytes
"use client";
/**
* CapacitorInit — client-only component that runs Capacitor bootstrap on mount.
* Rendered once in the root layout. No-ops cleanly in browser/PWA context.
*/
import { useEffect } from "react";
import { isNative, nativeStatusBar } from "@/lib/native";
export function CapacitorInit() {
useEffect(() => {
if (!isNative()) return;
// Set status bar style to match RotNot's dark theme
nativeStatusBar.setDark().catch(() => {
// Ignore — native plugin may not be available on all platforms
});
}, []);
// Renders nothing — purely a side-effect component
return null;
}