import { useEffect, useState } from "react"; import { ActivityIndicator, ScrollView, View } from "react-native"; import { Text } from "./fixed-text"; import { Button } from "./button"; import brandColors from "@/theme/brand-colors.json"; import { radius, type } from "@/theme/type"; // The screen page is black in both appearances: the dark half of each pair. const ACCENT = brandColors.accent[1]; const SECONDARY = brandColors.secondaryLabel[1]; const TERTIARY = brandColors.tertiaryLabel[1]; export function ScreenConnectionLoading({ preparing, onRetry, top, bottom }: { preparing: boolean; onRetry: () => void; top: number; bottom: number; }) { const [slow, setSlow] = useState(false); useEffect(() => { const timer = setTimeout(() => setSlow(true), 12000); return () => clearTimeout(timer); }, []); return ( {/* Connecting is a spinner, as everywhere a link is being made. */} {preparing ? "正在准备屏幕" : "正在连接电脑"} {slow ? "这次连接耗时较长。可以继续等待,或重新连接。" : preparing ? "电脑已响应,正在打开画面。" : "正在建立屏幕连接,画面会自动显示。"} 连接电脑 接收画面 显示桌面 {slow ?