diff --git a/web-chat/src/ChatList.tsx b/web-chat/src/ChatList.tsx index 615c3992b2..e74c48f235 100644 --- a/web-chat/src/ChatList.tsx +++ b/web-chat/src/ChatList.tsx @@ -6,7 +6,7 @@ import { ListItemText, Typography, } from '@material-ui/core'; -import React from 'react'; +import React, { useEffect, useRef } from 'react'; import { ChatMessage } from '../../build/main/chat/chat_message'; interface Props { @@ -22,7 +22,12 @@ export default function ChatList(props: Props) { )); - return {listItems}; + return ( + + {listItems} + + + ); } interface MessageProps { @@ -65,3 +70,15 @@ function Message(props: MessageProps) { ); } + +const AlwaysScrollToBottom = (props: Props) => { + const elementRef = useRef(); + + useEffect(() => { + // @ts-ignore + elementRef.current.scrollIntoView(); + }, [props.messages]); + + // @ts-ignore + return
; +};