Skip to content

Commit 7439885

Browse files
committed
Fix more suggestion
1 parent 44df696 commit 7439885

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

app/components/Views/confirmations/components/UI/animated-pulse/animated-pulse.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,12 @@ const AnimatedPulse = ({
2525
const cyclesNeededRef = useRef(0);
2626
const cyclesCompletedRef = useRef(0);
2727

28-
const durationFadeIn = 750;
29-
const durationFadeOut = 750;
30-
const durationFadeInFinal = 300;
28+
const cleanup = useCallback(() => {
29+
if (currentAnimationRef.current) {
30+
currentAnimationRef.current.stop();
31+
currentAnimationRef.current = null;
32+
}
33+
}, []);
3134

3235
useEffect(() => {
3336
if (isCurrentlyPulsingRef.current && !isPulsing) {
@@ -113,13 +116,8 @@ const AnimatedPulse = ({
113116
}
114117

115118
// Cleanup
116-
return () => {
117-
if (currentAnimationRef.current) {
118-
currentAnimationRef.current.stop();
119-
currentAnimationRef.current = null;
120-
}
121-
};
122-
}, [isPulsing, opacity, runSinglePulseCycle]);
119+
return cleanup;
120+
}, [cleanup, isPulsing, opacity, runSinglePulseCycle]);
123121

124122
return (
125123
<Animated.View style={{ opacity }} {...props}>

0 commit comments

Comments
 (0)