@codeimplants/ui-kit 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,16 +1,8 @@
1
- import React, { useEffect } from 'react';
2
- import Animated, {
3
- useSharedValue,
4
- useAnimatedProps,
5
- withRepeat,
6
- withSequence,
7
- withTiming,
8
- Easing,
9
- } from 'react-native-reanimated';
10
- import Svg, { Path, Circle } from 'react-native-svg';
1
+ import React, { useEffect, useRef } from 'react';
2
+ import { Animated, Easing } from 'react-native';
3
+ import Svg, { Path } from 'react-native-svg';
11
4
 
12
5
  const AnimatedPath = Animated.createAnimatedComponent(Path);
13
- const AnimatedCircle = Animated.createAnimatedComponent(Circle);
14
6
 
15
7
  interface AnimatedPermissionDeniedProps {
16
8
  size?: number;
@@ -25,65 +17,71 @@ export const AnimatedPermissionDenied: React.FC<AnimatedPermissionDeniedProps> =
25
17
  size = 64,
26
18
  color = '#EF4444',
27
19
  }) => {
28
- const shake = useSharedValue(0);
29
- const pulse = useSharedValue(1);
20
+ const shake = useRef(new Animated.Value(0)).current;
21
+ const pulse = useRef(new Animated.Value(1)).current;
30
22
 
31
23
  useEffect(() => {
32
- shake.value = withRepeat(
33
- withSequence(
34
- withTiming(0, { duration: 2000 }),
35
- withTiming(-3, { duration: 50 }),
36
- withTiming(3, { duration: 100 }),
37
- withTiming(-3, { duration: 100 }),
38
- withTiming(3, { duration: 100 }),
39
- withTiming(0, { duration: 50 })
40
- ),
41
- -1,
42
- false
43
- );
24
+ Animated.loop(
25
+ Animated.sequence([
26
+ Animated.timing(shake, { toValue: 0, duration: 2000, useNativeDriver: true }),
27
+ Animated.timing(shake, { toValue: -3, duration: 50, useNativeDriver: true }),
28
+ Animated.timing(shake, { toValue: 3, duration: 100, useNativeDriver: true }),
29
+ Animated.timing(shake, { toValue: -3, duration: 100, useNativeDriver: true }),
30
+ Animated.timing(shake, { toValue: 3, duration: 100, useNativeDriver: true }),
31
+ Animated.timing(shake, { toValue: 0, duration: 50, useNativeDriver: true }),
32
+ ])
33
+ ).start();
44
34
 
45
- pulse.value = withRepeat(
46
- withTiming(1.1, { duration: 1000, easing: Easing.inOut(Easing.ease) }),
47
- -1,
48
- true
49
- );
50
- }, []);
51
-
52
- const shieldProps = useAnimatedProps(() => ({
53
- transform: `translateX(${shake.value})`,
54
- }));
55
-
56
- const xProps = useAnimatedProps(() => ({
57
- transform: `scale(${pulse.value})`,
58
- transformOrigin: '32 32',
59
- }));
35
+ Animated.loop(
36
+ Animated.sequence([
37
+ Animated.timing(pulse, {
38
+ toValue: 1.1,
39
+ duration: 1000,
40
+ easing: Easing.inOut(Easing.ease),
41
+ useNativeDriver: true,
42
+ }),
43
+ Animated.timing(pulse, {
44
+ toValue: 1,
45
+ duration: 1000,
46
+ easing: Easing.inOut(Easing.ease),
47
+ useNativeDriver: true,
48
+ }),
49
+ ])
50
+ ).start();
51
+ }, [shake, pulse]);
60
52
 
61
53
  return (
62
54
  <Svg width={size} height={size} viewBox="0 0 64 64" fill="none">
63
55
  {/* Shield background */}
64
56
  <AnimatedPath
65
- animatedProps={shieldProps}
66
57
  d="M32 8 C32 8, 48 12, 48 20 C48 36, 32 56, 32 56 C32 56, 16 36, 16 20 C16 12, 32 8, 32 8 Z"
67
58
  fill={color}
68
59
  opacity={0.1}
60
+ style={{
61
+ transform: [{ translateX: shake }],
62
+ } as any}
69
63
  />
70
64
 
71
65
  {/* Shield outline */}
72
66
  <AnimatedPath
73
- animatedProps={shieldProps}
74
67
  d="M32 10 C32 10, 46 14, 46 20 C46 34, 32 52, 32 52 C32 52, 18 34, 18 20 C18 14, 32 10, 32 10 Z"
75
68
  stroke={color}
76
69
  strokeWidth="2.5"
77
70
  fill="none"
71
+ style={{
72
+ transform: [{ translateX: shake }],
73
+ } as any}
78
74
  />
79
75
 
80
76
  {/* X mark */}
81
77
  <AnimatedPath
82
- animatedProps={xProps}
83
78
  d="M24 24 L40 40 M40 24 L24 40"
84
79
  stroke={color}
85
80
  strokeWidth="3"
86
81
  strokeLinecap="round"
82
+ style={{
83
+ transform: [{ scale: pulse }],
84
+ } as any}
87
85
  />
88
86
  </Svg>
89
87
  );
@@ -0,0 +1,20 @@
1
+ import 'react-native-svg';
2
+ import { Animated } from 'react-native';
3
+
4
+ declare module 'react-native-svg' {
5
+ export interface GProps {
6
+ style?: any;
7
+ }
8
+ export interface PathProps {
9
+ style?: any;
10
+ }
11
+ export interface CircleProps {
12
+ style?: any;
13
+ }
14
+ export interface RectProps {
15
+ style?: any;
16
+ }
17
+ export interface SvgProps {
18
+ style?: any;
19
+ }
20
+ }
@@ -1,38 +0,0 @@
1
- /**
2
- * Type definitions for react-native-reanimated with react-native-svg
3
- *
4
- * This file provides proper type definitions for animated SVG components
5
- * to eliminate TypeScript errors when using animatedProps.
6
- */
7
-
8
- import 'react-native-reanimated';
9
- import { PathProps, CircleProps, RectProps, LineProps, PolygonProps } from 'react-native-svg';
10
-
11
- declare module 'react-native-reanimated' {
12
- export interface AnimatedProps<P> {
13
- animatedProps?: Partial<P>;
14
- }
15
- }
16
-
17
- // Extend SVG component props to accept animatedProps
18
- declare module 'react-native-svg' {
19
- interface PathProps {
20
- animatedProps?: any;
21
- }
22
-
23
- interface CircleProps {
24
- animatedProps?: any;
25
- }
26
-
27
- interface RectProps {
28
- animatedProps?: any;
29
- }
30
-
31
- interface LineProps {
32
- animatedProps?: any;
33
- }
34
-
35
- interface PolygonProps {
36
- animatedProps?: any;
37
- }
38
- }