Profile: Fix redundant scroll top animation

This commit is contained in:
Alexander Zinchuk 2021-12-25 12:41:13 +01:00
parent 0d48faba2f
commit 2a2ae99ed3
2 changed files with 3 additions and 2 deletions

View File

@ -47,7 +47,7 @@ export default function useProfileState(
}
const tabListEl = container.querySelector<HTMLDivElement>('.TabList');
if (!tabListEl) {
if (!tabListEl || tabListEl.offsetTop > container.scrollTop) {
return;
}

View File

@ -7,6 +7,7 @@ import {
FAST_SMOOTH_MAX_DISTANCE, FAST_SMOOTH_MAX_DURATION, FAST_SMOOTH_MIN_DURATION,
FAST_SMOOTH_SHORT_TRANSITION_MAX_DISTANCE,
} from '../config';
import { IS_ANDROID } from './environment';
import { dispatchHeavyAnimationEvent } from '../hooks/useHeavyAnimationCheck';
import { animateSingle } from './animation';
@ -89,7 +90,7 @@ function scrollWithJs(
switch (position) {
case 'start':
path = (elementTop - margin) - scrollFrom;
path = (elementTop - margin) - scrollFrom + (IS_ANDROID ? 1 : 0);
break;
case 'end':
path = (elementTop + elementHeight + margin) - (scrollFrom + targetContainerHeight);