import React, { useEffect, useRef } from 'react'; import { View, StyleSheet, Animated } from 'react-native'; import { Colors } from '../../constants/Colors'; interface SkeletonLoaderProps { width?: number | string; height?: number | string; borderRadius?: number; style?: any; } export default function SkeletonLoader({ width = '100%', height = 20, borderRadius = 4, style, }: SkeletonLoaderProps) { const animatedValue = useRef(new Animated.Value(0)).current; 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 ( ); } export function PostSkeleton() { return ( ); } export function CommentSkeleton() { return ( ); } export function StorySkeleton() { return ( ); } export function ProfileSkeleton() { return ( ); } export function NotificationSkeleton() { return ( ); } export function RepoCardSkeleton() { return ( ); } const skeletonStyles = StyleSheet.create({ container: { backgroundColor: Colors.background, marginBottom: 20, paddingBottom: 16, borderBottomWidth: 1, borderBottomColor: Colors.border, }, header: { flexDirection: 'row', alignItems: 'center', padding: 12, gap: 12, }, headerText: { flex: 1, }, footer: { padding: 12, }, commentContainer: { flexDirection: 'row', padding: 12, gap: 12, }, commentContent: { flex: 1, }, storyContainer: { alignItems: 'center', marginRight: 12, }, profileContainer: { alignItems: 'center', padding: 16, }, profileStats: { flexDirection: 'row', marginTop: 16, gap: 32, }, statItem: { alignItems: 'center', }, notificationContainer: { flexDirection: 'row', padding: 12, gap: 12, alignItems: 'center', }, notificationContent: { flex: 1, }, repoContainer: { backgroundColor: Colors.surface, borderRadius: 12, padding: 16, marginBottom: 12, }, repoHeader: { flexDirection: 'row', alignItems: 'center', gap: 8, }, repoFooter: { flexDirection: 'row', marginTop: 16, gap: 16, }, });