@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpg-engine/long-bow",
3
- "version": "0.7.18",
3
+ "version": "0.7.19",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -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()}>