File size: 626 Bytes
9580dce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"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;
}