import { Ionicons } from "@expo/vector-icons"; import { t } from "i18next"; import React, { useRef, useState } from "react"; import { Animated, Easing, Pressable, ScrollView, View } from "react-native"; import { Button } from "@/components/Button"; import { Text } from "@/components/common/Text"; import { useScaledTVTypography } from "@/constants/TVTypography"; import { TVInput } from "./TVInput"; interface TVAddServerFormProps { onConnect: (url: string) => Promise; onBack: () => void; loading?: boolean; disabled?: boolean; } const TVBackButton: React.FC<{ onPress: () => void; label: string; disabled?: boolean; }> = ({ onPress, label, disabled = false }) => { const [isFocused, setIsFocused] = useState(false); const scale = useRef(new Animated.Value(1)).current; const animateFocus = (focused: boolean) => { Animated.timing(scale, { toValue: focused ? 1.05 : 1, duration: 150, easing: Easing.out(Easing.quad), useNativeDriver: true, }).start(); }; return ( { setIsFocused(true); animateFocus(true); }} onBlur={() => { setIsFocused(false); animateFocus(false); }} style={{ alignSelf: "flex-start", marginBottom: 24 }} disabled={disabled} focusable={!disabled} > {label} ); }; export const TVAddServerForm: React.FC = ({ onConnect, onBack, loading = false, disabled = false, }) => { const typography = useScaledTVTypography(); const [serverURL, setServerURL] = useState(""); const handleConnect = async () => { if (serverURL.trim()) { await onConnect(serverURL.trim()); } }; const isDisabled = disabled || loading; return ( {/* Back Button */} {/* Server URL Input */} {/* Connect Button */} {/* Hint text */} {t("server.enter_url_to_jellyfin_server")} ); };