ChatWindow: don't focus on setting ref
This commit is contained in:
parent
9f0b7db8d8
commit
9365aa2cee
|
@ -58,7 +58,6 @@ const ChatWindow: React.FC<IChatWindow> = ({ idx, chatId, windowState }) => {
|
||||||
|
|
||||||
const handleInputRef = (el: HTMLTextAreaElement) => {
|
const handleInputRef = (el: HTMLTextAreaElement) => {
|
||||||
inputElem.current = el;
|
inputElem.current = el;
|
||||||
focusInput();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const focusInput = () => {
|
const focusInput = () => {
|
||||||
|
@ -66,8 +65,10 @@ const ChatWindow: React.FC<IChatWindow> = ({ idx, chatId, windowState }) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
focusInput();
|
if (windowState === 'open') {
|
||||||
}, [windowState === 'open']);
|
focusInput();
|
||||||
|
}
|
||||||
|
}, [windowState]);
|
||||||
|
|
||||||
if (!chat) return null;
|
if (!chat) return null;
|
||||||
const account = chat.account as unknown as AccountEntity;
|
const account = chat.account as unknown as AccountEntity;
|
||||||
|
|
Loading…
Reference in New Issue