updated search
This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user