Improve the logic for scrolling to the bottom

Remove unnecessary 20px offset, because `scrollHeight = clientHeight + scrollTop`
Fix: #905
This commit is contained in:
Jinmiao Luo 2023-04-18 20:21:06 +08:00
parent e68f17b463
commit e554de7a12

View File

@ -434,7 +434,7 @@ export function Chat(props: {
const [hitBottom, setHitBottom] = useState(false); const [hitBottom, setHitBottom] = useState(false);
const onChatBodyScroll = (e: HTMLElement) => { const onChatBodyScroll = (e: HTMLElement) => {
const isTouchBottom = e.scrollTop + e.clientHeight >= e.scrollHeight - 20; const isTouchBottom = e.scrollTop + e.clientHeight >= e.scrollHeight;
setHitBottom(isTouchBottom); setHitBottom(isTouchBottom);
}; };