Profile: Fix redundant scroll top animation
This commit is contained in:
parent
0d48faba2f
commit
2a2ae99ed3
@ -47,7 +47,7 @@ export default function useProfileState(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const tabListEl = container.querySelector<HTMLDivElement>('.TabList');
|
const tabListEl = container.querySelector<HTMLDivElement>('.TabList');
|
||||||
if (!tabListEl) {
|
if (!tabListEl || tabListEl.offsetTop > container.scrollTop) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import {
|
|||||||
FAST_SMOOTH_MAX_DISTANCE, FAST_SMOOTH_MAX_DURATION, FAST_SMOOTH_MIN_DURATION,
|
FAST_SMOOTH_MAX_DISTANCE, FAST_SMOOTH_MAX_DURATION, FAST_SMOOTH_MIN_DURATION,
|
||||||
FAST_SMOOTH_SHORT_TRANSITION_MAX_DISTANCE,
|
FAST_SMOOTH_SHORT_TRANSITION_MAX_DISTANCE,
|
||||||
} from '../config';
|
} from '../config';
|
||||||
|
import { IS_ANDROID } from './environment';
|
||||||
import { dispatchHeavyAnimationEvent } from '../hooks/useHeavyAnimationCheck';
|
import { dispatchHeavyAnimationEvent } from '../hooks/useHeavyAnimationCheck';
|
||||||
import { animateSingle } from './animation';
|
import { animateSingle } from './animation';
|
||||||
|
|
||||||
@ -89,7 +90,7 @@ function scrollWithJs(
|
|||||||
|
|
||||||
switch (position) {
|
switch (position) {
|
||||||
case 'start':
|
case 'start':
|
||||||
path = (elementTop - margin) - scrollFrom;
|
path = (elementTop - margin) - scrollFrom + (IS_ANDROID ? 1 : 0);
|
||||||
break;
|
break;
|
||||||
case 'end':
|
case 'end':
|
||||||
path = (elementTop + elementHeight + margin) - (scrollFrom + targetContainerHeight);
|
path = (elementTop + elementHeight + margin) - (scrollFrom + targetContainerHeight);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user