import React, { useState } from "react";
import { StyleSheet, Text, View, TouchableOpacity, Alert } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
import { useRouter } from "expo-router";
import { useAuth } from "@/context/auth-context";
export default function SettingsScreen() {
const router = useRouter()
const { logout } = useAuth();
const [theme, setTheme] = useState("light"); // light | dark | system
const handleLogout = () => {
Alert.alert("Logout", "Are you sure you want to logout?", [
{ text: "Cancel", style: "cancel" },
{
text: "Logout",
style: "destructive",
onPress: () => {
// TODO: clear auth state here
router.replace("/login");
logout();
},
},
]);
};
const toggleTheme = (value) => {
setTheme(value);
// TODO: persist theme (AsyncStorage / context / zustand)
};
return (
Settings
{/* Theme Selector */}
Theme
toggleTheme("light")}
/>
toggleTheme("dark")}
/>
toggleTheme("system")}
/>
{/* Logout */}
Account
Log Out
);
}
function ThemeButton({ label, active, onPress }) {
return (
{label}
);
}
const styles = StyleSheet.create({
screen: {
flex: 1,
backgroundColor: "#fff",
},
content: {
flex: 1,
paddingHorizontal: 16,
paddingTop: 12,
},
title: {
fontSize: 24,
fontWeight: "bold",
marginBottom: 20,
},
section: {
marginBottom: 24,
},
sectionTitle: {
fontSize: 16,
fontWeight: "600",
marginBottom: 10,
},
row: {
flexDirection: "row",
gap: 10,
},
themeButton: {
paddingVertical: 8,
paddingHorizontal: 12,
borderRadius: 8,
borderWidth: 1,
borderColor: "#ccc",
},
themeButtonActive: {
backgroundColor: "#111",
borderColor: "#111",
},
themeText: {
color: "#333",
paddingHorizontal: 5,
},
themeTextActive: {
color: "#fff",
},
logoutButton: {
padding: 14,
borderRadius: 10,
backgroundColor: "#ff3b30",
alignItems: "center",
},
logoutText: {
color: "#fff",
fontWeight: "600",
},
});