import { Ionicons } from "@expo/vector-icons"; import React, { useRef, useState } from "react"; import { ActivityIndicator, Animated, Easing, Pressable, View, } from "react-native"; import { Text } from "@/components/common/Text"; import { Colors } from "@/constants/Colors"; interface TVServerCardProps { title: string; subtitle?: string; securityIcon?: keyof typeof Ionicons.glyphMap | null; isLoading?: boolean; onPress: () => void; hasTVPreferredFocus?: boolean; } export const TVServerCard: React.FC = ({ title, subtitle, securityIcon, isLoading, onPress, hasTVPreferredFocus, }) => { const [isFocused, setIsFocused] = useState(false); const scale = useRef(new Animated.Value(1)).current; const glowOpacity = useRef(new Animated.Value(0)).current; const animateFocus = (focused: boolean) => { Animated.parallel([ Animated.timing(scale, { toValue: focused ? 1.02 : 1, duration: 150, easing: Easing.out(Easing.quad), useNativeDriver: true, }), Animated.timing(glowOpacity, { toValue: focused ? 0.7 : 0, duration: 150, easing: Easing.out(Easing.quad), useNativeDriver: true, }), ]).start(); }; const handleFocus = () => { setIsFocused(true); animateFocus(true); }; const handleBlur = () => { setIsFocused(false); animateFocus(false); }; return ( {title} {subtitle && ( {subtitle} )} {isLoading ? ( ) : securityIcon ? ( ) : ( )} ); };