import React, { useEffect, useRef } from 'react'; import { View, Text, StyleSheet, Dimensions, Animated, StatusBar, } from 'react-native'; import { SafeAreaView } from 'react-native-safe-area-context'; import { LinearGradient } from 'expo-linear-gradient'; import { useTheme } from '../../contexts/ThemeContext'; const { width, height } = Dimensions.get('window'); interface MetadataLoadingScreenProps { type?: 'movie' | 'series'; } export const MetadataLoadingScreen: React.FC = ({ type = 'movie' }) => { const { currentTheme } = useTheme(); // Animation values - removed fadeAnim since parent handles transitions const pulseAnim = useRef(new Animated.Value(0.3)).current; const shimmerAnim = useRef(new Animated.Value(0)).current; useEffect(() => { // Continuous pulse animation for skeleton elements const pulseAnimation = Animated.loop( Animated.sequence([ Animated.timing(pulseAnim, { toValue: 1, duration: 1200, useNativeDriver: true, }), Animated.timing(pulseAnim, { toValue: 0.3, duration: 1200, useNativeDriver: true, }), ]) ); // Shimmer effect for skeleton elements const shimmerAnimation = Animated.loop( Animated.timing(shimmerAnim, { toValue: 1, duration: 1500, useNativeDriver: true, }) ); pulseAnimation.start(); shimmerAnimation.start(); return () => { pulseAnimation.stop(); shimmerAnimation.stop(); }; }, []); const shimmerTranslateX = shimmerAnim.interpolate({ inputRange: [0, 1], outputRange: [-width, width], }); const SkeletonElement = ({ width: elementWidth, height: elementHeight, borderRadius = 8, marginBottom = 8, style = {}, }: { width: number | string; height: number; borderRadius?: number; marginBottom?: number; style?: any; }) => ( ); return ( {/* Hero Skeleton */} {/* Overlay content on hero */} {/* Bottom hero content skeleton */} {/* Content Section Skeletons */} {/* Synopsis skeleton */} {/* Cast section skeleton */} {[1, 2, 3, 4].map((item) => ( ))} {/* Episodes/Details skeleton based on type */} {type === 'series' ? ( {[1, 2, 3].map((item) => ( ))} ) : ( )} ); }; const styles = StyleSheet.create({ container: { flex: 1, }, content: { flex: 1, }, heroSection: { height: height * 0.6, position: 'relative', }, heroOverlay: { ...StyleSheet.absoluteFillObject, justifyContent: 'flex-end', }, heroBottomContent: { position: 'absolute', bottom: 20, left: 20, right: 20, }, genresRow: { flexDirection: 'row', marginBottom: 16, }, buttonsRow: { flexDirection: 'row', marginBottom: 8, }, contentSection: { padding: 20, }, synopsisSection: { marginBottom: 32, }, castSection: { marginBottom: 32, }, castRow: { flexDirection: 'row', marginTop: 16, }, castItem: { alignItems: 'center', marginRight: 16, }, episodesSection: { marginBottom: 32, }, episodeItem: { flexDirection: 'row', marginBottom: 16, alignItems: 'center', }, episodeInfo: { flex: 1, }, detailsSection: { marginBottom: 32, }, detailsGrid: { flexDirection: 'row', justifyContent: 'space-between', marginTop: 16, }, }); export default MetadataLoadingScreen;