managarten/memoro/apps/mobile/components/molecules/SpinnerAnimation.tsx
Till-JS e7f5f942f3 chore: initial commit - consolidate 4 projects into monorepo
Projects included:
- maerchenzauber (NestJS backend + Expo mobile + SvelteKit web + Astro landing)
- manacore (Expo mobile + SvelteKit web + Astro landing)
- manadeck (NestJS backend + Expo mobile + SvelteKit web)
- memoro (Expo mobile + SvelteKit web + Astro landing)

This commit preserves the current state before monorepo restructuring.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 23:38:24 +01:00

62 lines
1.4 KiB
TypeScript

import React, { useEffect, useRef } from 'react';
import { View, Animated, ViewStyle } from 'react-native';
import { useTheme } from '~/features/theme/ThemeProvider';
interface SpinnerAnimationProps {
size?: number;
style?: ViewStyle;
color?: string;
thickness?: number;
}
/**
* Minimalistischer rotierender Spinner
* Clean und modern - inspiriert von iOS/Material Design
*/
export function SpinnerAnimation({
size = 60,
style,
color,
thickness = 4
}: SpinnerAnimationProps) {
const { colors, isDark } = useTheme();
const rotateAnim = useRef(new Animated.Value(0)).current;
const spinnerColor = color || colors.primary;
useEffect(() => {
const animation = Animated.loop(
Animated.timing(rotateAnim, {
toValue: 1,
duration: 1000,
useNativeDriver: true,
})
);
animation.start();
return () => animation.stop();
}, [rotateAnim]);
const rotate = rotateAnim.interpolate({
inputRange: [0, 1],
outputRange: ['0deg', '360deg'],
});
return (
<View style={[{ alignItems: 'center', justifyContent: 'center' }, style]}>
<Animated.View
style={{
width: size,
height: size,
borderRadius: size / 2,
borderWidth: thickness,
borderColor: 'transparent',
borderTopColor: spinnerColor,
borderRightColor: spinnerColor,
transform: [{ rotate }],
}}
/>
</View>
);
}