Scroll to Bottom: Fix random stuck position (#6453)
This commit is contained in:
parent
f0c3d78dd1
commit
4180270eb5
@ -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 (
|
||||||
|
|||||||
@ -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}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user