import React, { useEffect } from 'react'; import { View, Animated, StyleSheet, ViewStyle } from 'react-native'; import { AppColors } from '../theme/colors'; interface SkeletonProps { width?: number | string; height?: number; borderRadius?: number; style?: ViewStyle; } /** * Loading Skeleton Component * Shimmer animation for loading states */ export const Skeleton: React.FC = ({ width = '100%', height = 20, borderRadius = 8, style, }) => { const animatedValue = React.useState(() => new Animated.Value(0))[0]; useEffect(() => { const animation = Animated.loop( Animated.sequence([ Animated.timing(animatedValue, { toValue: 1, duration: 1000, useNativeDriver: true, }), Animated.timing(animatedValue, { toValue: 0, duration: 1000, useNativeDriver: true, }), ]) ); animation.start(); return () => animation.stop(); }, [animatedValue]); const opacity = animatedValue.interpolate({ inputRange: [0, 1], outputRange: [0.3, 0.7], }); return ( ); }; /** * Card Skeleton for loading states */ export const CardSkeleton: React.FC = () => ( ); /** * List Item Skeleton */ export const ListItemSkeleton: React.FC = () => ( ); // Export LoadingSkeleton as an alias for compatibility export const LoadingSkeleton = Skeleton; const styles = StyleSheet.create({ skeleton: { backgroundColor: AppColors.border, }, cardSkeleton: { backgroundColor: AppColors.surface, borderRadius: 16, padding: 16, marginBottom: 16, }, row: { flexDirection: 'row', gap: 12, }, listItem: { flexDirection: 'row', alignItems: 'center', padding: 16, gap: 12, backgroundColor: AppColors.surface, borderRadius: 12, marginBottom: 8, }, listItemContent: { flex: 1, }, });