import { useState, useEffect } from 'react' import { View, Text, StyleSheet, Pressable, StatusBar as RNStatusBar, ActivityIndicator, } from 'react-native' import { StatusBar } from 'expo-status-bar' import { SafeAreaView } from 'react-native-safe-area-context' import { useRouter } from 'expo-router' import { TopArrowIcon } from '@/components/icon' import { useCategories } from '@/hooks/data/use-categories' export default function ChannelsScreen() { const router = useRouter() const [isExpanded, setIsExpanded] = useState(true) const [selectedChannel, setSelectedChannel] = useState('') const { load, loading, data } = useCategories() useEffect(() => { load({ isActive: true }) }, []) return ( {/* 顶部容器 - 包含 header 和频道选择区域,带底部圆角 */} {/* 标题栏 */} 全部频道 { if (isExpanded) { router.push('/') } else { setIsExpanded(true) } }} > {/* 频道选择区域 */} {isExpanded && ( {loading ? ( ) : ( {data?.categories.map((category) => ( setSelectedChannel(category.id)} > {category.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', }, channelsSection: { paddingHorizontal: 12, paddingBottom: 12, }, channelsGrid: { flexDirection: 'row', flexWrap: 'wrap', gap: 8, }, channelButtonDefault: { backgroundColor: '#262A31', borderRadius: 100, paddingVertical: 8, paddingHorizontal: 17, borderWidth: 1, borderColor: '#262A31', }, channelButtonSelected: { backgroundColor: '#FF6B35', borderColor: '#FF6B35', }, channelButtonText: { color: '#F5F5F5', fontSize: 12, fontWeight: '500', textAlign: 'center', }, loadingContainer: { paddingVertical: 20, alignItems: 'center', }, })