updated search

This commit is contained in:
DevOFVictory
2025-10-23 18:49:01 +02:00
parent 0fbe217fce
commit 30dab9051a
6 changed files with 76 additions and 70 deletions

View File

@@ -1,4 +1,5 @@
import { Season, Show } from "@/app/types";
import { Season } from "@/apis/seasonApi";
import { Show } from "@/apis/showApi";
import { FontAwesome } from "@expo/vector-icons";
import React from "react";
import { Dimensions, FlatList, LayoutChangeEvent, NativeScrollEvent, NativeSyntheticEvent, Pressable, StyleSheet, View } from "react-native";
@@ -18,7 +19,7 @@ export default function SeasonCarousel({
}) {
const [currentIndex, setCurrentIndex] = React.useState(0);
const [sliderWidth, setSliderWidth] = React.useState(Math.floor(WINDOW_WIDTH - 20));
const listRef = React.useRef<FlatList<Season> | null>(null);
const listRef = React.useRef<FlatList<Season>>(null);
const onLayout = (e: LayoutChangeEvent) => {
const w = Math.max(0, Math.floor(e.nativeEvent.layout.width));
@@ -47,9 +48,9 @@ export default function SeasonCarousel({
return (
<View style={{ marginBottom: 10, backgroundColor: "#1b1e2b", borderRadius: 10 }} onLayout={onLayout}>
<FlatList
ref={(r) => (listRef.current = r)}
ref={listRef}
data={seasons}
keyExtractor={(season, idx) => `${show.showId}-${(season as any)?.seasonId ?? `season-${idx}`}`}
keyExtractor={(season, idx) => `${show.id}-${(season as any)?.seasonId ?? `season-${idx}`}`}
horizontal
pagingEnabled
showsHorizontalScrollIndicator={false}
@@ -71,7 +72,7 @@ export default function SeasonCarousel({
<View style={carouselStyles.dotsRow}>
{seasons.map((_, i) => (
<View key={`dot-${show.showId}-${i}`} style={[carouselStyles.dot, i === currentIndex && carouselStyles.dotActive]} />
<View key={`dot-${show.id}-${i}`} style={[carouselStyles.dot, i === currentIndex && carouselStyles.dotActive]} />
))}
</View>