Skip to content

Commit

Permalink
fix(project): reset scroll on video and series screens
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristiaanScheermeijer committed Jun 23, 2021
1 parent b01d29d commit 7bcc930
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/screens/Movie/Movie.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ const Movie = ({
};
}, [play]);

useEffect(() => {
(document.scrollingElement || document.body).scrollTop = 0;
}, []);

const { data: playlist } = useRecommendedPlaylist(config.recommendationsPlaylist || '', item);

const handleComplete = useCallback(() => {
Expand Down
4 changes: 4 additions & 0 deletions src/screens/Series/Series.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ const Series = ({
};
}, [play]);

useEffect(() => {
(document.scrollingElement || document.body).scrollTop = 0;
}, []);

if (isLoading || playlistIsLoading) return <LoadingOverlay />;
if (error || !item) return <ErrorPage title="Episode not found!" />;
if (playlistError || !seriesPlaylist) return <ErrorPage title="Series not found!" />;
Expand Down

0 comments on commit 7bcc930

Please sign in to comment.