diff options
| author | Mohamed Bassem <me@mbassem.com> | 2026-02-09 00:25:45 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-09 00:25:45 +0000 |
| commit | b41b5647aa10d22ca83cfd3ba97146681e9f28a3 (patch) | |
| tree | 2fff51df620ce7ccbf9934db9b91ca7444ce9b08 /apps/mobile/components/sharing/ErrorAnimation.tsx | |
| parent | 07f4d7d6eff4306605725de911f90e03d6db1fe4 (diff) | |
| download | karakeep-b41b5647aa10d22ca83cfd3ba97146681e9f28a3.tar.zst | |
feat(mobile): Add animated UI feedback to sharing modal (#2427)
* feat(mobile): Add animated UI feedback to sharing modal
---------
Co-authored-by: Claude <noreply@anthropic.com>
Diffstat (limited to 'apps/mobile/components/sharing/ErrorAnimation.tsx')
| -rw-r--r-- | apps/mobile/components/sharing/ErrorAnimation.tsx | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/apps/mobile/components/sharing/ErrorAnimation.tsx b/apps/mobile/components/sharing/ErrorAnimation.tsx new file mode 100644 index 00000000..c5cc743a --- /dev/null +++ b/apps/mobile/components/sharing/ErrorAnimation.tsx @@ -0,0 +1,41 @@ +import { useEffect } from "react"; +import { View } from "react-native"; +import Animated, { + useAnimatedStyle, + useSharedValue, + withSequence, + withSpring, + withTiming, +} from "react-native-reanimated"; +import * as Haptics from "expo-haptics"; +import { AlertCircle } from "lucide-react-native"; + +export default function ErrorAnimation() { + const scale = useSharedValue(0); + const shake = useSharedValue(0); + + useEffect(() => { + Haptics.notificationAsync(Haptics.NotificationFeedbackType.Error); + + scale.value = withSpring(1, { damping: 12, stiffness: 200 }); + shake.value = withSequence( + withTiming(-10, { duration: 50 }), + withTiming(10, { duration: 100 }), + withTiming(-10, { duration: 100 }), + withTiming(10, { duration: 100 }), + withTiming(0, { duration: 50 }), + ); + }, []); + + const style = useAnimatedStyle(() => ({ + transform: [{ scale: scale.value }, { translateX: shake.value }], + })); + + return ( + <Animated.View style={style} className="items-center gap-4"> + <View className="h-24 w-24 items-center justify-center rounded-full bg-destructive"> + <AlertCircle size={48} color="white" strokeWidth={2} /> + </View> + </Animated.View> + ); +} |
