bug fixes
This commit is contained in:
@@ -39,6 +39,10 @@ export default function ChatWindow({ group, onBack, onGroupUpdated, onDirectMess
|
||||
return () => window.removeEventListener('resize', onResize);
|
||||
}, []);
|
||||
|
||||
const scrollToBottom = useCallback((smooth = false) => {
|
||||
messagesEndRef.current?.scrollIntoView({ behavior: smooth ? 'smooth' : 'auto' });
|
||||
}, []);
|
||||
|
||||
// On mobile, when the soft keyboard opens the visual viewport shrinks but the
|
||||
// messages-container scroll position stays where it was, leaving the latest
|
||||
// messages hidden behind the keyboard. Scroll to bottom whenever the visual
|
||||
@@ -68,10 +72,6 @@ export default function ChatWindow({ group, onBack, onGroupUpdated, onDirectMess
|
||||
};
|
||||
}, []);
|
||||
|
||||
const scrollToBottom = useCallback((smooth = false) => {
|
||||
messagesEndRef.current?.scrollIntoView({ behavior: smooth ? 'smooth' : 'auto' });
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!group) { setMessages([]); return; }
|
||||
setMessages([]);
|
||||
|
||||
Reference in New Issue
Block a user