diff --git a/front/views/PlayView.tsx b/front/views/PlayView.tsx index c65dbf1..ce60716 100644 --- a/front/views/PlayView.tsx +++ b/front/views/PlayView.tsx @@ -258,19 +258,22 @@ const PlayView = ({ songId }: PlayViewProps) => { }; useEffect(() => { - ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.LANDSCAPE).catch(() => {}); + if (playType == 'practice') return; + const interval = setInterval(() => { - if (playType != 'practice') { - setTime(() => getElapsedTime()); - } // Countdown + setTime(() => getElapsedTime()); }, 200); + return () => clearInterval(interval); + }, [playType]); + + useEffect(() => { + ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.LANDSCAPE).catch(() => {}); return () => { ScreenOrientation.unlockAsync().catch(() => {}); stopwatch.stop(); - clearInterval(interval); }; - }, [playType]); + }, []); useEffect(() => { // Song.data is updated on navigation.navigate (do not know why)