import React from 'react'; import { View, Text, StyleSheet, FlatList, TouchableOpacity, ActivityIndicator, } from 'react-native'; import { Image } from 'expo-image'; import Animated, { FadeIn, } from 'react-native-reanimated'; import { useTheme } from '../../contexts/ThemeContext'; interface CastSectionProps { cast: any[]; loadingCast: boolean; onSelectCastMember: (castMember: any) => void; } export const CastSection: React.FC = ({ cast, loadingCast, onSelectCastMember, }) => { const { currentTheme } = useTheme(); if (loadingCast) { return ( ); } if (!cast || cast.length === 0) { return null; } return ( Cast item.id.toString()} renderItem={({ item, index }) => ( onSelectCastMember(item)} activeOpacity={0.7} > {item.profile_path ? ( ) : ( {item.name.split(' ').reduce((prev: string, current: string) => prev + current[0], '').substring(0, 2)} )} {item.name} {item.character && ( {item.character} )} )} /> ); }; const styles = StyleSheet.create({ castSection: { marginBottom: 24, paddingHorizontal: 0, }, loadingContainer: { paddingVertical: 20, alignItems: 'center', justifyContent: 'center', }, sectionHeader: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', marginBottom: 12, paddingHorizontal: 16, }, sectionTitle: { fontSize: 18, fontWeight: '700', }, castList: { paddingHorizontal: 16, paddingBottom: 4, }, castCard: { marginRight: 16, width: 90, alignItems: 'center', }, castImageContainer: { width: 80, height: 80, borderRadius: 40, overflow: 'hidden', marginBottom: 8, }, castImage: { width: '100%', height: '100%', }, castImagePlaceholder: { width: '100%', height: '100%', borderRadius: 40, alignItems: 'center', justifyContent: 'center', }, placeholderText: { fontSize: 24, fontWeight: '600', }, castName: { fontSize: 14, fontWeight: '600', textAlign: 'center', width: 90, }, characterName: { fontSize: 12, textAlign: 'center', width: 90, marginTop: 2, }, });