mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-20 14:52:13 +00:00
Fix Discover Scroll
The scroll of the Discover page would not go to top once a genre or page was changed.
This commit is contained in:
parent
748f14a664
commit
76433a4b9a
1 changed files with 6 additions and 1 deletions
|
|
@ -67,6 +67,11 @@ const Discover = ({ urlParams, queryParams }) => {
|
|||
closeAddonModal();
|
||||
setSelectedMetaItemIndex(0);
|
||||
}, [discover.selected]);
|
||||
const metaItemsContainerRef = React.useRef();
|
||||
React.useEffect(() => {
|
||||
if (((discover.catalog || {}).content || {}).type === 'Loading')
|
||||
metaItemsContainerRef.current.scrollTo(0,0);
|
||||
}, [discover.catalog]);
|
||||
return (
|
||||
<MainNavBars className={styles['discover-container']} route={'discover'}>
|
||||
<div className={styles['discover-content']}>
|
||||
|
|
@ -124,7 +129,7 @@ const Discover = ({ urlParams, queryParams }) => {
|
|||
</div>
|
||||
:
|
||||
discover.catalog.content.type === 'Loading' ?
|
||||
<div className={styles['meta-items-container']}>
|
||||
<div className={styles['meta-items-container']} ref={metaItemsContainerRef}>
|
||||
{Array(CONSTANTS.CATALOG_PAGE_SIZE).fill(null).map((_, index) => (
|
||||
<div key={index} className={styles['meta-item-placeholder']}>
|
||||
<div className={styles['poster-container']} />
|
||||
|
|
|
|||
Loading…
Reference in a new issue