From 784eb3afe14fb82dd325bd4feca8c22e74298dd9 Mon Sep 17 00:00:00 2001 From: DevOFVictory <49123418+mafeth@users.noreply.github.com> Date: Sun, 2 Nov 2025 23:28:57 +0100 Subject: [PATCH] update --- app/(tabs)/index.tsx | 56 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 48 insertions(+), 8 deletions(-) diff --git a/app/(tabs)/index.tsx b/app/(tabs)/index.tsx index 509b8d1..fd30111 100644 --- a/app/(tabs)/index.tsx +++ b/app/(tabs)/index.tsx @@ -9,19 +9,32 @@ import React from "react"; import { ActivityIndicator, Image, + RefreshControl, + ScrollView as RNScrollView, Text, TouchableOpacity, View, } from "react-native"; import { GestureHandlerRootView, - ScrollView, + ScrollView, // horizontaler ScrollView bleibt aus RNGH } from "react-native-gesture-handler"; export default function HomeScreen() { - const { data: shows = [], error, isLoading: loading } = useShows(); - const { data: streamingServices = {} } = useStreamingServices(); + const { + data: shows = [], + error, + isLoading: loading, + refetch: refetchShows, // ⬅️ refetch aus Hook + } = useShows(); + + const { + data: streamingServices = {}, + refetch: refetchServices, // ⬅️ refetch aus Hook + } = useStreamingServices(); + const [activeFilter, setActiveFilter] = React.useState("all"); + const [refreshing, setRefreshing] = React.useState(false); // ⬅️ UI-State für Pull-to-Refresh const haptikFeedback = () => { Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light); @@ -36,6 +49,20 @@ export default function HomeScreen() { } }; + // ⬅️ Pull-to-Refresh Handler + const onRefresh = React.useCallback(async () => { + haptikFeedback(); + setRefreshing(true); + try { + await Promise.all([ + typeof refetchShows === "function" ? refetchShows() : Promise.resolve(), + typeof refetchServices === "function" ? refetchServices() : Promise.resolve(), + ]); + } finally { + setRefreshing(false); + } + }, [refetchShows, refetchServices]); + const filteredShows = React.useMemo(() => { if (activeFilter === "all") { return shows; @@ -92,12 +119,13 @@ export default function HomeScreen() { { + haptikFeedback(); router.push("/legal"); }} style={{ position: "absolute", left: 16, - top: "63%", + top: "50%", transform: [{ translateY: -12 }], height: 40, width: 40, @@ -114,11 +142,23 @@ export default function HomeScreen() { FLTR - + } > + {/* ⬅️ HORIZONTALER SCROLLBEREICH BLEIBT AUS RNGH */} + {filteredShows.map((show) => { const showLiveBadge = show.running; - return ( - + );