fix(tv): android tv black screen

This commit is contained in:
Fredrik Burmester
2026-01-23 08:21:00 +01:00
parent fb9b4b6f2d
commit 3a4042efd5

View File

@@ -9,12 +9,10 @@ import {
Alert, Alert,
Animated, Animated,
Easing, Easing,
KeyboardAvoidingView,
Pressable, Pressable,
ScrollView, ScrollView,
View, View,
} from "react-native"; } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
import { z } from "zod"; import { z } from "zod";
import { Button } from "@/components/Button"; import { Button } from "@/components/Button";
import { Text } from "@/components/common/Text"; import { Text } from "@/components/common/Text";
@@ -414,8 +412,10 @@ export const TVLogin: React.FC = () => {
const handleConnect = useCallback(async (url: string) => { const handleConnect = useCallback(async (url: string) => {
url = url.trim().replace(/\/$/, ""); url = url.trim().replace(/\/$/, "");
console.log("[TVLogin] handleConnect called with:", url);
try { try {
const result = await checkUrl(url); const result = await checkUrl(url);
console.log("[TVLogin] checkUrl result:", result);
if (result === undefined) { if (result === undefined) {
Alert.alert( Alert.alert(
t("login.connection_failed"), t("login.connection_failed"),
@@ -423,8 +423,12 @@ export const TVLogin: React.FC = () => {
); );
return; return;
} }
console.log("[TVLogin] Calling setServer with:", result);
await setServer({ address: result }); await setServer({ address: result });
} catch {} console.log("[TVLogin] setServer completed successfully");
} catch (error) {
console.error("[TVLogin] Error in handleConnect:", error);
}
}, []); }, []);
const handleQuickConnect = async () => { const handleQuickConnect = async () => {
@@ -445,9 +449,12 @@ export const TVLogin: React.FC = () => {
} }
}; };
// Debug logging
console.log("[TVLogin] Render - api?.basePath:", api?.basePath);
return ( return (
<SafeAreaView style={{ flex: 1, backgroundColor: "#000000" }}> <View style={{ flex: 1, backgroundColor: "#000000" }}>
<KeyboardAvoidingView behavior='padding' style={{ flex: 1 }}> <View style={{ flex: 1 }}>
{api?.basePath ? ( {api?.basePath ? (
// ==================== CREDENTIALS SCREEN ==================== // ==================== CREDENTIALS SCREEN ====================
<ScrollView <ScrollView
@@ -660,7 +667,7 @@ export const TVLogin: React.FC = () => {
</View> </View>
</ScrollView> </ScrollView>
)} )}
</KeyboardAvoidingView> </View>
{/* Save Account Modal */} {/* Save Account Modal */}
<TVSaveAccountModal <TVSaveAccountModal
@@ -709,6 +716,6 @@ export const TVLogin: React.FC = () => {
onDelete={handleServerActionDelete} onDelete={handleServerActionDelete}
onClose={() => setShowServerActionSheet(false)} onClose={() => setShowServerActionSheet(false)}
/> />
</SafeAreaView> </View>
); );
}; };