@rpg-engine/long-bow 0.7.18 → 0.7.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/long-bow.cjs.development.js +5 -1
- package/dist/long-bow.cjs.development.js.map +1 -1
- package/dist/long-bow.cjs.production.min.js +1 -1
- package/dist/long-bow.cjs.production.min.js.map +1 -1
- package/dist/long-bow.esm.js +5 -1
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Chat/Chat.tsx +5 -2
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import dayjs from 'dayjs';
|
|
2
|
-
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
3
3
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
4
4
|
import { FaTimes } from 'react-icons/fa';
|
|
5
5
|
import styled from 'styled-components';
|
|
@@ -45,9 +45,12 @@ export const Chat: React.FC<IChatProps> = ({
|
|
|
45
45
|
},
|
|
46
46
|
}) => {
|
|
47
47
|
const [message, setMessage] = useState('');
|
|
48
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
48
49
|
|
|
49
50
|
useEffect(() => {
|
|
50
51
|
scrollChatToBottom();
|
|
52
|
+
// Focus the input element when the component mounts
|
|
53
|
+
inputRef.current?.focus();
|
|
51
54
|
}, [chatMessages]);
|
|
52
55
|
|
|
53
56
|
const scrollChatToBottom = () => {
|
|
@@ -96,6 +99,7 @@ export const Chat: React.FC<IChatProps> = ({
|
|
|
96
99
|
|
|
97
100
|
<Form onSubmit={handleSubmit}>
|
|
98
101
|
<TextField
|
|
102
|
+
ref={inputRef}
|
|
99
103
|
value={message}
|
|
100
104
|
onChange={e => setMessage(e.target.value)}
|
|
101
105
|
type="text"
|
|
@@ -103,7 +107,6 @@ export const Chat: React.FC<IChatProps> = ({
|
|
|
103
107
|
onFocus={onFocus}
|
|
104
108
|
onBlur={onBlur}
|
|
105
109
|
onPointerDown={onFocus}
|
|
106
|
-
autoFocus
|
|
107
110
|
placeholder="Type your message..."
|
|
108
111
|
/>
|
|
109
112
|
<SendButton type="submit" disabled={!message.trim()}>
|