Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(reactions): remove emoji after animation finishes to avoid native node race

Calin-Teodor9d968aab32c9
diff --git a/react/features/reactions/components/native/ReactionEmoji.tsx b/react/features/reactions/components/native/ReactionEmoji.tsx
index 75e37045ad..0db935b2b6 100644
--- a/react/features/reactions/components/native/ReactionEmoji.tsx
+++ b/react/features/reactions/components/native/ReactionEmoji.tsx
@@ -44,18 +44,19 @@ function ReactionEmoji({ reaction, uid, index }: IProps) {
useEffect(() => {
- setTimeout(() => dispatch(removeReaction(uid)), 5000);
- }, []);
-
- useEffect(() => {
- Animated.timing(
+ const animation = Animated.timing(
animationVal,
{
toValue: 1,
duration: 5000,
useNativeDriver: true
}
- ).start();
+ );
+
+ // Remove only after the animation finishes, so unmount does not race it.
+ animation.start(({ finished }) => finished && dispatch(removeReaction(uid)));
+
+ return () => animation.stop();
}, [ animationVal ]);