mirror of
https://github.com/zimplexing/OrionTV.git
synced 2026-02-04 03:36:29 +08:00
Update
This commit is contained in:
@@ -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() {
|
||||
</View>
|
||||
) : error ? (
|
||||
<View style={styles.centerContainer}>
|
||||
<ThemedText type="subtitle">{error}</ThemedText>
|
||||
<ThemedText type="subtitle" style={{ padding: 10 }}>
|
||||
{error}
|
||||
</ThemedText>
|
||||
</View>
|
||||
) : (
|
||||
<FlatList
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useEffect } from "react";
|
||||
import React, { useState, useEffect, useRef } from "react";
|
||||
import {
|
||||
Modal,
|
||||
View,
|
||||
@@ -25,13 +25,19 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
|
||||
onSave,
|
||||
}) => {
|
||||
const [apiUrl, setApiUrl] = useState("");
|
||||
const [isInputFocused, setIsInputFocused] = useState(false);
|
||||
const colorScheme = useColorScheme();
|
||||
const inputRef = useRef<TextInput>(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<SettingsModalProps> = ({
|
||||
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<SettingsModalProps> = ({
|
||||
<ThemedView style={styles.modalContent}>
|
||||
<ThemedText style={styles.title}>设置</ThemedText>
|
||||
<TextInput
|
||||
style={styles.input}
|
||||
ref={inputRef}
|
||||
style={[styles.input, isInputFocused && styles.inputFocused]}
|
||||
value={apiUrl}
|
||||
onChangeText={setApiUrl}
|
||||
placeholder="输入 API 地址"
|
||||
placeholderTextColor={colorScheme === "dark" ? "#888" : "#555"}
|
||||
autoCapitalize="none"
|
||||
autoCorrect={false}
|
||||
onFocus={() => setIsInputFocused(true)}
|
||||
onBlur={() => setIsInputFocused(false)}
|
||||
/>
|
||||
<View style={styles.buttonContainer}>
|
||||
<Pressable
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
"test": "jest --watchAll",
|
||||
"lint": "expo lint",
|
||||
"prebuild": "EXPO_USE_METRO_WORKSPACE_ROOT=1 expo prebuild --clean",
|
||||
"prebuild-tv": "EXPO_TV=1 EXPO_USE_METRO_WORKSPACE_ROOT=1 expo prebuild --clean && yarn copy-config",
|
||||
"prebuild-tv": "EXPO_TV=1 EXPO_USE_METRO_WORKSPACE_ROOT=1 expo prebuild --clean",
|
||||
"copy-config": "cp -r xml/* android/app/src/*",
|
||||
"build-local": "cd android && ./gradlew assembleRelease"
|
||||
},
|
||||
|
||||
@@ -178,7 +178,7 @@ export class SettingsManager {
|
||||
theme: "auto",
|
||||
autoPlay: true,
|
||||
playbackSpeed: 1.0,
|
||||
apiBaseUrl: "http://127.0.0.1:3001",
|
||||
apiBaseUrl: "",
|
||||
};
|
||||
try {
|
||||
const data = await AsyncStorage.getItem(STORAGE_KEYS.SETTINGS);
|
||||
|
||||
Reference in New Issue
Block a user