import { View, Text, StyleSheet, FlatList, TouchableOpacity, Image, Switch } from "react-native";
import { usePacksStore } from "../../src/store";
import { Ionicons } from "@expo/vector-icons";
import { router } from "expo-router";
import { useEffect } from "react";
export default function PacksScreen() {
const { packs, enabledPackIds, togglePack, isLoading, fetchPacks } = usePacksStore();
useEffect(() => {
fetchPacks();
}, []);
const renderItem = ({ item }: { item: any }) => (
router.push(`/pack/${item.id}`)}
>
{item.icon || "📦"}
{item.name}
{item.is_premium && (
PRO
)}
{item.description}
togglePack(item.id)}
trackColor={{ false: "#767577", true: "#e94560" }}
thumbColor={"#fff"}
/>
);
return (
Question Packs
item.id}
contentContainerStyle={styles.list}
refreshing={isLoading}
onRefresh={fetchPacks}
/>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#1a1a2e",
},
header: {
paddingTop: 60,
paddingHorizontal: 24,
paddingBottom: 24,
borderBottomWidth: 1,
borderBottomColor: "#16213e",
},
title: {
fontSize: 28,
fontWeight: "bold",
color: "#fff",
},
list: {
padding: 24,
},
card: {
flexDirection: "row",
alignItems: "center",
backgroundColor: "#16213e",
borderRadius: 16,
padding: 16,
marginBottom: 16,
borderWidth: 1,
borderColor: "#0f3460",
},
cardContent: {
flex: 1,
flexDirection: "row",
alignItems: "center",
},
iconContainer: {
width: 48,
height: 48,
borderRadius: 24,
backgroundColor: "rgba(255, 255, 255, 0.05)",
justifyContent: "center",
alignItems: "center",
marginRight: 16,
},
emoji: {
fontSize: 24,
},
content: {
flex: 1,
marginRight: 16,
},
headerRow: {
flexDirection: "row",
alignItems: "center",
marginBottom: 4,
},
name: {
fontSize: 18,
fontWeight: "600",
color: "#fff",
marginRight: 8,
},
badge: {
backgroundColor: "#e94560",
paddingHorizontal: 6,
paddingVertical: 2,
borderRadius: 4,
},
badgeText: {
color: "#fff",
fontSize: 10,
fontWeight: "bold",
},
description: {
fontSize: 14,
color: "#888",
lineHeight: 20,
},
});