import React, { useEffect, useState } from "react"; import { View, Text, ScrollView, TouchableOpacity, Image, StyleSheet, } from "react-native"; import { useRouter } from "expo-router"; import { useAuthStore } from "../store/authStore"; import { getFollowedLiveRooms } from "../services/api"; import { LivePulse } from "./LivePulse"; import { proxyImageUrl } from "../utils/imageUrl"; import { useTheme } from "../utils/theme"; import type { LiveRoom } from "../services/types"; export function FollowedLiveStrip() { const { sessdata } = useAuthStore(); const [rooms, setRooms] = useState([]); const router = useRouter(); const theme = useTheme(); useEffect(() => { if (!sessdata) return; getFollowedLiveRooms() .then(setRooms) .catch(() => {}); }, [sessdata]); if (!sessdata || rooms.length === 0) return null; return ( {rooms.map((room, index) => ( router.push(`/live/${room.roomid}` as any)} activeOpacity={0.7} > 直播 {room.uname.length > 5 ? room.uname.slice(0, 5) : room.uname} ))} ); } const styles = StyleSheet.create({ container: { backgroundColor: "#f4f4f4", paddingHorizontal: 4, paddingVertical: 8, }, scrollContent: { gap: 12, alignItems: "center", }, item: { alignItems: "center", width: 56, position: "relative", }, pulseRow: { position: "absolute", backgroundColor: "rgba(0,0,0,0.6)", bottom: 18, paddingHorizontal: 6, paddingVertical: 1, borderRadius: 10, zIndex: 100, display: "flex", flexDirection: "row", alignItems: "center", }, avatar: { width: 44, height: 44, borderRadius: 22, backgroundColor: "#eee", }, name: { fontSize: 11, color: "#333", marginTop: 4, textAlign: "center", width: 56, }, });