aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/ui/MessageInput.js
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2019-07-26 13:22:00 +0300
committerGravatar Vitaly Takmazov2023-01-13 10:37:55 +0300
commitf707d3d524d8d16e2bb780764f029d85fc57ecc0 (patch)
tree1580074a665bd16c9744b5749c2a777700c5ae73 /vnext/src/ui/MessageInput.js
parent6016b0888e77497e15384f1cd024eb42672129a4 (diff)
prop-types -> jsdoc
Diffstat (limited to 'vnext/src/ui/MessageInput.js')
-rw-r--r--vnext/src/ui/MessageInput.js33
1 files changed, 21 insertions, 12 deletions
diff --git a/vnext/src/ui/MessageInput.js b/vnext/src/ui/MessageInput.js
index 63c2ee79..bc9ddd54 100644
--- a/vnext/src/ui/MessageInput.js
+++ b/vnext/src/ui/MessageInput.js
@@ -1,7 +1,4 @@
import React, { useState, useEffect, useRef } from 'react';
-import PropTypes from 'prop-types';
-
-import { MessageType } from './Types';
import Icon from './Icon';
import Button from './Button';
@@ -9,7 +6,10 @@ import Button from './Button';
import UploadButton from './UploadButton';
-// StackOverflow-driven development: https://stackoverflow.com/a/10158364/1097384
+/**
+ * StackOverflow-driven development: https://stackoverflow.com/a/10158364/1097384
+ * @param {HTMLTextAreaElement} el
+ */
function moveCaretToEnd(el) {
if (typeof el.selectionStart == 'number') {
el.selectionStart = el.selectionEnd = el.value.length;
@@ -21,8 +21,25 @@ function moveCaretToEnd(el) {
}
}
+/**
+ * @typedef {Object} MessageInputProps
+ * @property {string} text
+ * @property {import('../api').Message} data
+ * @property {function} onSend
+ */
+
+/**
+ * MessageInput
+ * @param {HTMLTextAreaElement & MessageInputProps} props
+ */
export default function MessageInput({ text, data, rows, children, onSend }) {
+ /**
+ * @type {React.MutableRefObject<HTMLTextAreaElement>}
+ */
let textareaRef = useRef();
+ /**
+ * @type {React.MutableRefObject<HTMLInputElement>}
+ */
let fileinput = useRef();
let updateFocus = () => {
@@ -114,11 +131,3 @@ const textInputStyle = {
outline: 'none',
padding: '4px'
};
-
-MessageInput.propTypes = {
- children: PropTypes.node,
- data: MessageType.isRequired,
- onSend: PropTypes.func.isRequired,
- rows: PropTypes.string,
- text: PropTypes.string
-};