// ClockProgress.tsx import React from 'react'; import Svg, { Circle, Path } from 'react-native-svg'; interface ClockProgressProps { degree: number; // Valor entre 0 y 360 width: number; // Ancho del SVG height: number; // Alto del SVG color: string; } function polarToCartesian(cx: number, cy: number, r: number, angleDeg: number) { const angleRad = (angleDeg - 90) * Math.PI / 180; return { x: cx + r * Math.cos(angleRad), y: cy + r * Math.sin(angleRad) }; } function describeSector(cx: number, cy: number, r: number, startAngle: number, endAngle: number) { const start = polarToCartesian(cx, cy, r, endAngle); const end = polarToCartesian(cx, cy, r, startAngle); const largeArc = endAngle - startAngle <= 180 ? 0 : 1; return [ `M ${cx},${cy}`, `L ${start.x},${start.y}`, `A ${r},${r} 0 ${largeArc} 0 ${end.x},${end.y}`, 'Z' ].join(' '); } const ClockProgress: React.FC = ({ degree, width, height, color }) => { const path = describeSector(100, 100, 70, 0, degree == 360 ? 359.9 : degree); return ( ); }; export default ClockProgress; // Create a exported function that returns the SVG as a string export function getClockProgressSVG(degree: number, width: number, height: number, color: string): string { const path = describeSector(100, 100, 70, 0, degree == 360 ? 359.9 : degree); const svg = ( ` ` ); return svg; }