Scroll to Bottom: Fix random stuck position (#6453)

This commit is contained in:
zubiden 2025-11-11 14:37:37 +01:00 committed by Alexander Zinchuk
parent f0c3d78dd1
commit 4180270eb5
2 changed files with 5 additions and 4 deletions

View File

@ -1,23 +1,25 @@
import { memo, useRef } from '@teact'; import { memo, useRef } from '@teact';
import { FocusDirection } from '../../types';
import buildClassName from '../../util/buildClassName'; import buildClassName from '../../util/buildClassName';
import useFocusMessageListElement from './message/hooks/useFocusMessageListElement'; import useFocusMessageListElement from './message/hooks/useFocusMessageListElement';
type OwnProps = { type OwnProps = {
isJustAdded?: boolean;
isFocused?: boolean; isFocused?: boolean;
className?: string; className?: string;
}; };
const MessageListBottomMarker = ({ isJustAdded, isFocused, className }: OwnProps) => { const MessageListBottomMarker = ({ isFocused, className }: OwnProps) => {
const ref = useRef<HTMLDivElement>(); const ref = useRef<HTMLDivElement>();
useFocusMessageListElement({ useFocusMessageListElement({
elementRef: ref, elementRef: ref,
isJustAdded, isJustAdded: true,
isFocused, isFocused,
noFocusHighlight: true, noFocusHighlight: true,
focusDirection: FocusDirection.Down,
}); });
return ( return (

View File

@ -463,7 +463,6 @@ const MessageListContent = ({
{isViewportNewest && ( {isViewportNewest && (
<MessageListBottomMarker <MessageListBottomMarker
key="bottom-marker" key="bottom-marker"
isJustAdded={isNewMessage}
isFocused={shouldScrollToBottom} isFocused={shouldScrollToBottom}
className={shouldRenderSponsoredMessage ? 'with-sponsored' : undefined} className={shouldRenderSponsoredMessage ? 'with-sponsored' : undefined}
/> />