import React from "react"; import Animated, { Easing, useAnimatedProps, useSharedValue, withTiming, } from "react-native-reanimated"; import { Circle, Svg } from "react-native-svg"; import { AntDesign } from "@expo/vector-icons"; import { View } from "tamagui"; const AnimatedCircle = Animated.createAnimatedComponent(Circle); export const StatusCircle = ({ type, percentage = 0, }: { type: string; percentage: number; }) => { const radius = 25; const strokeWidth = 5; const circleCircumference = 2 * Math.PI * radius; const strokeDashoffset = useSharedValue(circleCircumference); React.useEffect(() => { strokeDashoffset.value = withTiming( circleCircumference - (circleCircumference * percentage) / 100, { duration: 500, easing: Easing.linear, }, ); }, [circleCircumference, percentage, strokeDashoffset]); const animatedProps = useAnimatedProps(() => ({ strokeDashoffset: strokeDashoffset.value, })); const renderIcon = () => { switch (type) { case "success": return ; case "error": return ; default: return null; } }; return ( {type === "loading" && ( )} {renderIcon()} ); };