mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-20 10:42:12 +00:00
fix: SideDrawer glitched element movement.
Even when using `onTransitionEnd`, the `scrollIntoView` problem persists. The solution that i found is to use `requestAnimationFrame` two times, turns out that's enough time after the component mounts to fix the problem.
This commit is contained in:
parent
a0d3a50122
commit
5f106f49d3
1 changed files with 7 additions and 3 deletions
|
|
@ -80,9 +80,13 @@ const SideDrawer = memo(forwardRef<HTMLDivElement, Props>(({ seriesInfo, classNa
|
|||
|
||||
const jumpToPlayingNow = () => {
|
||||
const { current } = selectedVideoRef;
|
||||
if (current) {
|
||||
current.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
}
|
||||
if (!current) return;
|
||||
|
||||
requestAnimationFrame(() => {
|
||||
requestAnimationFrame(() => {
|
||||
current.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
|
|||
Loading…
Reference in a new issue