Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Commit

Permalink
Fix canva crash on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
Octopus773 committed Jan 18, 2024
1 parent 9e3c2d1 commit 0b78772
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions front/views/PlayView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0b78772

Please sign in to comment.