mirror of
https://github.com/danog/telegram-tt.git
synced 2024-11-26 20:34:44 +01:00
[Refactoring] Transition: Get rid of redundant scroll-slide
animation
This commit is contained in:
parent
03b6b9d079
commit
60acbc2f02
@ -16,7 +16,7 @@ type OwnProps = {
|
||||
ref?: RefObject<HTMLDivElement>;
|
||||
activeKey: number;
|
||||
name: (
|
||||
'none' | 'slide' | 'slide-reversed' | 'mv-slide' | 'slide-fade' | 'zoom-fade' | 'scroll-slide' | 'slide-layers'
|
||||
'none' | 'slide' | 'slide-reversed' | 'mv-slide' | 'slide-fade' | 'zoom-fade' | 'slide-layers'
|
||||
| 'fade' | 'push-slide' | 'reveal'
|
||||
);
|
||||
direction?: 'auto' | 'inverse' | 1 | -1;
|
||||
@ -131,14 +131,6 @@ const Transition: FC<OwnProps> = ({
|
||||
}
|
||||
});
|
||||
|
||||
if (name === 'scroll-slide') {
|
||||
const width = container.offsetWidth;
|
||||
container.scrollBy({
|
||||
left: activeIndex > prevActiveIndex ? width : -width,
|
||||
behavior: 'smooth',
|
||||
});
|
||||
}
|
||||
|
||||
let dispatchHeavyAnimationStop: NoneToVoidFunction;
|
||||
if (animationLevel > 0) {
|
||||
dispatchHeavyAnimationStop = dispatchHeavyAnimationEvent();
|
||||
@ -160,10 +152,6 @@ const Transition: FC<OwnProps> = ({
|
||||
}
|
||||
});
|
||||
|
||||
if (name === 'scroll-slide') {
|
||||
container.scrollLeft = activeKey * container.offsetWidth;
|
||||
}
|
||||
|
||||
if (shouldRestoreHeight) {
|
||||
const activeElement = container.querySelector<HTMLDivElement>('.active');
|
||||
|
||||
@ -250,7 +238,7 @@ const Transition: FC<OwnProps> = ({
|
||||
const fullClassName = buildClassName(
|
||||
'Transition',
|
||||
className,
|
||||
animationLevel === 0 && name === 'scroll-slide' ? 'slide' : name,
|
||||
name,
|
||||
);
|
||||
|
||||
return (
|
||||
|
Loading…
Reference in New Issue
Block a user