|
9 | 9 | import Animated, { |
10 | 10 | useAnimatedStyle, |
11 | 11 | useSharedValue, |
12 | | - withSpring, |
| 12 | + withDelay, |
| 13 | + withSequence, |
| 14 | + withTiming, |
13 | 15 | } from 'react-native-reanimated'; |
14 | 16 | import Svg, { Circle } from 'react-native-svg'; |
15 | 17 |
|
@@ -73,20 +75,26 @@ const Icon: React.FC< |
73 | 75 |
|
74 | 76 | const showReaction = () => { |
75 | 77 | 'worklet'; |
76 | | - scale.value = withSpring(1); |
| 78 | + scale.value = withSequence( |
| 79 | + withDelay(250, withTiming(1.5, { duration: 500 })), |
| 80 | + withTiming(1, { duration: 500 }), |
| 81 | + ); |
77 | 82 | }; |
78 | 83 |
|
79 | 84 | useEffect(() => { |
80 | 85 | showReaction(); |
81 | 86 | }, []); |
82 | 87 |
|
83 | | - const animatedStyle = useAnimatedStyle<ViewStyle>(() => ({ |
84 | | - transform: [ |
85 | | - { |
86 | | - scale: scale.value, |
87 | | - }, |
88 | | - ], |
89 | | - })); |
| 88 | + const animatedStyle = useAnimatedStyle<ViewStyle>( |
| 89 | + () => ({ |
| 90 | + transform: [ |
| 91 | + { |
| 92 | + scale: scale.value, |
| 93 | + }, |
| 94 | + ], |
| 95 | + }), |
| 96 | + [], |
| 97 | + ); |
90 | 98 |
|
91 | 99 | return ( |
92 | 100 | <Animated.View style={animatedStyle}> |
@@ -178,16 +186,19 @@ const ReactionListWithContext = < |
178 | 186 |
|
179 | 187 | const showReactions = (show: boolean) => { |
180 | 188 | 'worklet'; |
181 | | - opacity.value = show ? withSpring(1) : 0; |
| 189 | + opacity.value = show ? withDelay(250, withTiming(1, { duration: 500 })) : 0; |
182 | 190 | }; |
183 | 191 |
|
184 | 192 | useEffect(() => { |
185 | 193 | showReactions(hasSupportedReactions); |
186 | 194 | }, [hasSupportedReactions]); |
187 | 195 |
|
188 | | - const animatedStyle = useAnimatedStyle<ViewStyle>(() => ({ |
189 | | - opacity: opacity.value, |
190 | | - })); |
| 196 | + const animatedStyle = useAnimatedStyle<ViewStyle>( |
| 197 | + () => ({ |
| 198 | + opacity: opacity.value, |
| 199 | + }), |
| 200 | + [], |
| 201 | + ); |
191 | 202 |
|
192 | 203 | if (!hasSupportedReactions) { |
193 | 204 | return null; |
|
0 commit comments