Message List: Fix scrolling gets stuck in message list (#2893)

This commit is contained in:
Alexander Zinchuk 2023-03-30 18:26:20 -05:00
parent 07658472b5
commit 5dadb3c3c9

View File

@ -66,6 +66,7 @@ import usePrevious from '../../hooks/usePrevious';
import useForceUpdate from '../../hooks/useForceUpdate';
import useSyncEffect from '../../hooks/useSyncEffect';
import useAppLayout from '../../hooks/useAppLayout';
import useTimeout from '../../hooks/useTimeout';
import usePinnedMessage from './hooks/usePinnedMessage';
import Transition from '../ui/Transition';
@ -138,6 +139,8 @@ function isImage(item: DataTransferItem) {
return item.kind === 'file' && item.type && SUPPORTED_IMAGE_CONTENT_TYPES.has(item.type);
}
const LAYER_ANIMATION_DURATION_MS = 450 + ANIMATION_END_DELAY;
const MiddleColumn: FC<OwnProps & StateProps> = ({
chatId,
threadId,
@ -206,7 +209,7 @@ const MiddleColumn: FC<OwnProps & StateProps> = ({
const [isUnpinModalOpen, setIsUnpinModalOpen] = useState(false);
const isMobileSearchActive = isMobile && hasCurrentTextSearch;
const closeAnimationDuration = isMobile ? 450 + ANIMATION_END_DELAY : undefined;
const closeAnimationDuration = isMobile ? LAYER_ANIMATION_DURATION_MS : undefined;
const hasTools = hasPinned && (
windowWidth < MOBILE_SCREEN_MAX_WIDTH
|| (
@ -744,6 +747,12 @@ function useIsReady(
}
}, [withAnimations]);
useTimeout(() => {
if (!isReady) {
setIsReady(true);
}
}, LAYER_ANIMATION_DURATION_MS);
function handleOpenEnd(e: React.TransitionEvent<HTMLDivElement>) {
if (e.propertyName === 'transform' && e.target === e.currentTarget) {
setIsReady(Boolean(chatId));