import { ThemedText } from "@/components/themed-text"; import { IconSymbol } from "@/components/ui/icon-symbol"; import { Colors } from "@/constants/theme"; import { useTheme } from "@/context/ThemeContext"; import { League } from "@/types/api"; import { Image } from "expo-image"; import React from "react"; import { useTranslation } from "react-i18next"; import { Modal, Pressable, ScrollView, StyleSheet, View } from "react-native"; import { SafeAreaView } from "react-native-safe-area-context"; interface LeagueModalProps { visible: boolean; onClose: () => void; leagues: League[]; selectedLeagueKey: string | null; onSelect: (leagueKey: string) => void; } export function LeagueModal({ visible, onClose, leagues, selectedLeagueKey, onSelect, }: LeagueModalProps) { const { theme } = useTheme(); const { t } = useTranslation(); const isDark = theme === "dark"; const bg = isDark ? "#1C1C1E" : "#FFFFFF"; const text = isDark ? "#FFFFFF" : "#000000"; return ( {t("home.select_league")} {leagues.length === 0 ? ( {t("home.no_leagues")} ) : ( leagues.map((league) => { const isSelected = selectedLeagueKey === league.key; const optionBg = isDark ? "#2C2C2E" : "#F5F5F5"; const iconBg = isDark ? "#3A3A3C" : "#E5E5EA"; return ( { onSelect(league.key); onClose(); }} > {/* 左侧图标 */} {league.logo ? ( ) : ( )} {/* 中间内容 */} {league.name} {league.countryName && ( {league.countryName} )} {/* 右侧指示点 */} ); }) )} ); } const styles = StyleSheet.create({ overlay: { flex: 1, backgroundColor: "rgba(0,0,0,0.5)", }, sheet: { borderTopLeftRadius: 20, borderTopRightRadius: 20, padding: 20, height: "55%", }, header: { flexDirection: "row", justifyContent: "space-between", alignItems: "center", marginBottom: 20, }, title: { fontSize: 18, fontWeight: "600", }, closeButton: { width: 32, height: 32, alignItems: "center", justifyContent: "center", }, scrollView: { maxHeight: 400, }, emptyContainer: { padding: 40, alignItems: "center", justifyContent: "center", }, emptyText: { fontSize: 16, opacity: 0.6, }, option: { flexDirection: "row", alignItems: "center", paddingVertical: 16, paddingHorizontal: 16, marginBottom: 12, borderRadius: 12, }, iconContainer: { width: 48, height: 48, borderRadius: 24, alignItems: "center", justifyContent: "center", marginRight: 12, }, leagueLogo: { width: 32, height: 32, }, content: { flex: 1, }, leagueName: { fontSize: 16, marginBottom: 4, }, countryName: { fontSize: 12, opacity: 0.6, }, indicator: { width: 8, height: 8, borderRadius: 4, marginLeft: 12, }, });