import React, { useRef, useState } from "react"; import { Animated, Easing, Pressable, TextInput, type TextInputProps, View, } from "react-native"; import { Text } from "@/components/common/Text"; interface TVInputProps extends TextInputProps { label?: string; hasTVPreferredFocus?: boolean; } export const TVInput: React.FC = ({ label, hasTVPreferredFocus, style, ...props }) => { const [isFocused, setIsFocused] = useState(false); const inputRef = useRef(null); const scale = useRef(new Animated.Value(1)).current; const animateFocus = (focused: boolean) => { Animated.timing(scale, { toValue: focused ? 1.02 : 1, duration: 200, easing: Easing.out(Easing.quad), useNativeDriver: true, }).start(); }; const handleFocus = () => { setIsFocused(true); animateFocus(true); }; const handleBlur = () => { setIsFocused(false); animateFocus(false); }; return ( {label && ( {label} )} inputRef.current?.focus()} onFocus={handleFocus} onBlur={handleBlur} hasTVPreferredFocus={hasTVPreferredFocus} > {/* Outer glow layer - only visible when focused */} {isFocused && ( )} {/* Main input container */} {/* Inner highlight bar when focused */} {isFocused && ( )} ); };