diff --git a/app/index.tsx b/app/index.tsx index fdd9e92..31c20a5 100644 --- a/app/index.tsx +++ b/app/index.tsx @@ -148,7 +148,6 @@ export default function HomeScreen() { setHasMore(true); } } catch (err: any) { - console.error("Failed to load data:", err); if (err.message === "API_URL_NOT_SET") { setError("请点击右上角设置按钮,配置您的 API 地址"); } else { @@ -297,7 +296,9 @@ export default function HomeScreen() { ) : error ? ( - {error} + + {error} + ) : ( = ({ onSave, }) => { const [apiUrl, setApiUrl] = useState(""); + const [isInputFocused, setIsInputFocused] = useState(false); const colorScheme = useColorScheme(); + const inputRef = useRef(null); useEffect(() => { if (visible) { SettingsManager.get().then((settings) => { setApiUrl(settings.apiBaseUrl); }); + const timer = setTimeout(() => { + inputRef.current?.focus(); + }, 200); + return () => clearTimeout(timer); } }, [visible]); @@ -72,6 +78,14 @@ export const SettingsModal: React.FC = ({ color: colorScheme === "dark" ? "white" : "black", borderColor: "transparent", }, + inputFocused: { + borderColor: "#007AFF", + shadowColor: "#007AFF", + shadowOffset: { width: 0, height: 0 }, + shadowOpacity: 0.8, + shadowRadius: 10, + elevation: 5, + }, buttonContainer: { flexDirection: "row", justifyContent: "space-around", @@ -115,13 +129,16 @@ export const SettingsModal: React.FC = ({ 设置 setIsInputFocused(true)} + onBlur={() => setIsInputFocused(false)} />