import { useState } from 'react' import { View, Text, StyleSheet, Pressable, StatusBar as RNStatusBar, } from 'react-native' import { StatusBar } from 'expo-status-bar' import { LinearGradient } from 'expo-linear-gradient' import { SafeAreaView } from 'react-native-safe-area-context' import { useRouter } from 'expo-router' import { useTranslation } from 'react-i18next' import { TopArrowIcon } from '@/components/icon' import GradientText from '@/components/GradientText' export default function ChannelsScreen() { const { t } = useTranslation() const router = useRouter() const [isExpanded, setIsExpanded] = useState(true) const [selectedChannel, setSelectedChannel] = useState(2) // 默认选中第二个频道 // 频道数据 const channels = Array.from({ length: 13 }, (_, i) => ({ id: i + 1, name: t('channels.channelName'), })) return ( {/* 顶部容器 - 包含 header 和频道选择区域,带底部圆角 */} {/* 标题栏 */} {t('channels.title')} { if (isExpanded) { router.push('/') } else { setIsExpanded(true) } }} > {/* 频道选择区域 */} {isExpanded && ( {channels.map((channel) => { return ( setSelectedChannel(channel.id)} style={[styles.channelButtonWrapper]} > {selectedChannel === channel.id ? ( {channel.name} ) : ( {channel.name} )} ) })} )} ) } const styles = StyleSheet.create({ screen: { flex: 1, backgroundColor: '#0A0A0A', }, topContainer: { backgroundColor: '#16181B', borderBottomLeftRadius: 16, borderBottomRightRadius: 16, overflow: 'hidden', }, safeArea: { backgroundColor: '#16181B', }, header: { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', paddingHorizontal: 16, paddingTop: 27, paddingBottom: 12, }, headerTitle: { color: '#F5F5F5', fontSize: 12, fontWeight: '500', }, searchText: { color: '#ABABAB', fontSize: 14, fontWeight: '400', }, channelsSection: { paddingHorizontal: 12, paddingBottom: 12, }, channelsGrid: { flexDirection: 'row', flexWrap: 'wrap', gap: 8, }, channelButtonWrapper: { // 按钮宽度根据内容自适应 }, channelButtonGradient: { borderRadius: 100, padding: 1, }, channelButtonWrapperUnselected: { borderRadius: 100, padding: 1, backgroundColor: 'transparent', }, channelButtonDefault: { backgroundColor: '#262A31', borderRadius: 100, paddingVertical: 8, paddingHorizontal: 17, borderWidth: 1, borderColor: '#262A31', }, channelButtonText: { color: '#F5F5F5', fontSize: 12, fontWeight: '500', textAlign: 'center', }, })