diff --git a/components/jellyseerr/ParallaxSlideShow.tsx b/components/jellyseerr/ParallaxSlideShow.tsx index 1e3d3f4f..6a7fcb7f 100644 --- a/components/jellyseerr/ParallaxSlideShow.tsx +++ b/components/jellyseerr/ParallaxSlideShow.tsx @@ -50,7 +50,6 @@ const ParallaxSlideShow = ({ const insets = useSafeAreaInsets(); const [currentIndex, setCurrentIndex] = useState(0); - const [onEnd, setOnEnd] = useState(true); const fadeAnim = useRef(new Animated.Value(0)).current; const enterAnimation = useCallback( @@ -76,16 +75,22 @@ const ParallaxSlideShow = ({ useEffect(() => { if (images?.length) { enterAnimation().start(); + const intervalId = setInterval(() => { - exitAnimation().start((end) => { - if (end.finished) - setCurrentIndex((prevIndex) => (prevIndex + 1) % images?.length); - }); + Animated.sequence([ + enterAnimation(), + exitAnimation() + ]).start(() => { + fadeAnim.setValue(0); + setCurrentIndex((prevIndex) => (prevIndex + 1) % images?.length); + }) }, BACKDROP_DURATION); - return () => clearInterval(intervalId); + return () => { + clearInterval(intervalId) + }; } - }, [images, enterAnimation, exitAnimation, setCurrentIndex, currentIndex]); + }, [fadeAnim, images, enterAnimation, exitAnimation, setCurrentIndex, currentIndex]); return (