import Styles from "@/constants/Styles"; import { useTheme } from "@/providers/ThemeProvider"; import { MaterialCommunityIcons } from "@expo/vector-icons"; import { useEffect, useRef } from "react"; import { Animated, View } from "react-native"; import Text from "./Text"; type Props = { progress: number doneCount?: number totalCount?: number } export default function SectionProgress({ progress, doneCount, totalCount }: Props) { const { colors } = useTheme(); const animatedWidth = useRef(new Animated.Value(0)).current; const progressColor = colors.tabActive; const statusLabel = progress === 100 ? 'Selesai' : progress > 0 ? 'Sedang berlangsung' : 'Belum dimulai'; useEffect(() => { animatedWidth.setValue(0); Animated.timing(animatedWidth, { toValue: progress, duration: 900, useNativeDriver: false, }).start(); }, [progress]); return ( Kemajuan Kegiatan {statusLabel} {progress}% {totalCount !== undefined && doneCount !== undefined && ( {doneCount}/{totalCount} tugas )} ); }