import { useEffect } from 'react'; import { StyleSheet, ViewStyle } from 'react-native'; import Animated, { Easing, useAnimatedStyle, useSharedValue, withRepeat, withTiming } from 'react-native-reanimated'; import Svg, { Circle } from 'react-native-svg'; import { colors } from '../theme/colors'; type LoadingSpinnerProps = { size?: number; color?: string; style?: ViewStyle; }; export const LoadingSpinner = ({ size = 36, color = colors.accent, style }: LoadingSpinnerProps) => { const rotation = useSharedValue(0); const strokeWidth = Math.max(4, size * 0.14); const center = size / 2; const radius = center - strokeWidth; const circumference = 2 * Math.PI * radius; useEffect(() => { rotation.value = withRepeat(withTiming(360, { duration: 900, easing: Easing.linear }), -1); }, [rotation]); const animatedStyle = useAnimatedStyle(() => ({ transform: [{ rotateZ: `${rotation.value}deg` }], })); return ( ); }; const styles = StyleSheet.create({ container: { alignItems: 'center', justifyContent: 'center', }, });