Skip to content

Commit 4668c37

Browse files
committed
tweak animation timing for reactions
1 parent 6ce3207 commit 4668c37

File tree

1 file changed

+24
-13
lines changed

1 file changed

+24
-13
lines changed

src/components/Message/MessageSimple/ReactionList.tsx

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ import {
99
import Animated, {
1010
useAnimatedStyle,
1111
useSharedValue,
12-
withSpring,
12+
withDelay,
13+
withSequence,
14+
withTiming,
1315
} from 'react-native-reanimated';
1416
import Svg, { Circle } from 'react-native-svg';
1517

@@ -73,20 +75,26 @@ const Icon: React.FC<
7375

7476
const showReaction = () => {
7577
'worklet';
76-
scale.value = withSpring(1);
78+
scale.value = withSequence(
79+
withDelay(250, withTiming(1.5, { duration: 500 })),
80+
withTiming(1, { duration: 500 }),
81+
);
7782
};
7883

7984
useEffect(() => {
8085
showReaction();
8186
}, []);
8287

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+
);
9098

9199
return (
92100
<Animated.View style={animatedStyle}>
@@ -178,16 +186,19 @@ const ReactionListWithContext = <
178186

179187
const showReactions = (show: boolean) => {
180188
'worklet';
181-
opacity.value = show ? withSpring(1) : 0;
189+
opacity.value = show ? withDelay(250, withTiming(1, { duration: 500 })) : 0;
182190
};
183191

184192
useEffect(() => {
185193
showReactions(hasSupportedReactions);
186194
}, [hasSupportedReactions]);
187195

188-
const animatedStyle = useAnimatedStyle<ViewStyle>(() => ({
189-
opacity: opacity.value,
190-
}));
196+
const animatedStyle = useAnimatedStyle<ViewStyle>(
197+
() => ({
198+
opacity: opacity.value,
199+
}),
200+
[],
201+
);
191202

192203
if (!hasSupportedReactions) {
193204
return null;

0 commit comments

Comments
 (0)