mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
use onTransitionEnded and remove setTimeout
This commit is contained in:
parent
524bcd90da
commit
dad52d61ed
1 changed files with 4 additions and 4 deletions
|
|
@ -78,15 +78,15 @@ const SideDrawer = memo(forwardRef<HTMLDivElement, Props>(({ seriesInfo, classNa
|
|||
|
||||
const currentlyPlayingVideoRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const jumpToPlayingNow = () => {
|
||||
const { current } = currentlyPlayingVideoRef;
|
||||
if (current) {
|
||||
setTimeout(() => { current.scrollIntoView({ behavior: 'smooth', block: 'center' }); }, 300);
|
||||
current.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
}
|
||||
}, []);
|
||||
};
|
||||
|
||||
return (
|
||||
<div ref={ref} className={classNames(styles['side-drawer'], className)} onMouseDown={onMouseDown}>
|
||||
<div ref={ref} className={classNames(styles['side-drawer'], className)} onTransitionEnd={jumpToPlayingNow} onMouseDown={onMouseDown}>
|
||||
<div className={styles['close-button']} onClick={closeSideDrawer}>
|
||||
<Icon className={styles['icon']} name={'chevron-forward'} />
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue