import React, { useState } from "react"; import { View, ScrollView, Pressable, Image, Switch, Modal, TouchableOpacity, TouchableWithoutFeedback, } from "react-native"; import { router } from "expo-router"; import { Text } from "@/components/ui/text"; import { ArrowLeft, Settings, ChevronRight, CreditCard, ShieldCheck, FileText, HelpCircle, History, Bell, LogOut, User, Lock, } from "@/lib/icons"; import { ScreenWrapper } from "@/components/ScreenWrapper"; import { ShadowWrapper } from "@/components/ShadowWrapper"; import { useColorScheme } from "nativewind"; import { saveTheme, AppTheme } from "@/lib/theme"; // ── Theme bottom sheet ──────────────────────────────────────────── const THEME_OPTIONS = [ { value: "light", label: "Light" }, { value: "dark", label: "Dark" }, { value: "system", label: "System Default" }, ] as const; type ThemeOption = (typeof THEME_OPTIONS)[number]["value"]; function ThemeSheet({ visible, current, onSelect, onClose, }: { visible: boolean; current: ThemeOption; onSelect: (v: ThemeOption) => void; onClose: () => void; }) { return ( {/* Handle */} Appearance {THEME_OPTIONS.map((opt, i) => { const selected = current === opt.value; const isLast = i === THEME_OPTIONS.length - 1; return ( { onSelect(opt.value); onClose(); }} className={`flex-row items-center justify-between py-3.5 px-1 ${!isLast ? "border-b border-border/40" : ""}`} > {opt.label} {selected && } ); })} ); } // ── Shared menu components ──────────────────────────────────────── function MenuGroup({ label, children, }: { label: string; children: React.ReactNode; }) { return ( {label} {children} ); } function MenuItem({ icon, label, sublabel, onPress, right, destructive = false, isLast = false, }: { icon: React.ReactNode; label: string; sublabel?: string; onPress?: () => void; right?: React.ReactNode; destructive?: boolean; isLast?: boolean; }) { return ( {icon} {label} {sublabel ? ( {sublabel} ) : null} {right !== undefined ? right : } ); } // ── Screen ──────────────────────────────────────────────────────── export default function ProfileScreen() { const { setColorScheme, colorScheme } = useColorScheme(); const [notifications, setNotifications] = useState(true); const [themeSheetVisible, setThemeSheetVisible] = useState(false); const currentTheme: ThemeOption = (colorScheme as ThemeOption) ?? "system"; const handleThemeSelect = (val: AppTheme) => { setColorScheme(val === "system" ? "system" : val); saveTheme(val); // persist across restarts }; return ( {/* Header */} router.back()} className="h-10 w-10 rounded-[10px] bg-card items-center justify-center border border-border" > Profile {/* Edit Profile shortcut */} {}} className="h-10 w-10 rounded-[10px] bg-card items-center justify-center border border-border" > {/* Avatar */} Ms. Charlotte charlotte@example.com {/* Account */} } label="Subscription" sublabel="Pro Plan — active" onPress={() => {}} /> } label="Transaction History" onPress={() => {}} isLast /> {/* Preferences */} } label="Push Notifications" right={ } /> } label="Appearance" sublabel={ THEME_OPTIONS.find((o) => o.value === currentTheme)?.label ?? "System Default" } onPress={() => setThemeSheetVisible(true)} /> } label="Security" sublabel="PIN & Biometrics" onPress={() => {}} isLast /> {/* Support & Legal */} } label="Help & Support" onPress={() => {}} /> } label="Privacy Policy" onPress={() => {}} /> } label="Terms of Use" onPress={() => {}} isLast /> {/* Logout */} } label="Log Out" destructive onPress={() => {}} right={null} isLast /> {/* Theme sheet */} setThemeSheetVisible(false)} /> ); }