stop typing indicator on message received

This commit is contained in:
or-else
2021-08-22 19:40:08 -07:00
parent bf19cd1351
commit 8294248e2d
5 changed files with 12 additions and 11 deletions
+4 -4
View File
@@ -508,7 +508,8 @@ class MessagesView extends React.Component {
return; return;
} }
this.setState({latestMsgSeq: topic.maxMsgSeq()}); clearTimeout(this.keyPressTimer)
this.setState({latestMsgSeq: topic.maxMsgSeq(), typingIndicator: false});
// If the message is added to the end of the message list, // If the message is added to the end of the message list,
// scroll to the bottom. // scroll to the bottom.
@@ -538,9 +539,8 @@ class MessagesView extends React.Component {
switch (info.what) { switch (info.what) {
case 'kp': { case 'kp': {
clearTimeout(this.keyPressTimer); clearTimeout(this.keyPressTimer);
var instance = this; this.keyPressTimer = setTimeout(() => {
this.keyPressTimer = setTimeout(function() { this.setState({typingIndicator: false});
instance.setState({typingIndicator: false});
}, KEYPRESS_DELAY + 1000); }, KEYPRESS_DELAY + 1000);
if (!this.state.typingIndicator) { if (!this.state.typingIndicator) {
this.setState({typingIndicator: true}); this.setState({typingIndicator: true});
+5 -4
View File
@@ -3255,8 +3255,10 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
return; return;
} }
clearTimeout(this.keyPressTimer);
this.setState({ this.setState({
latestMsgSeq: topic.maxMsgSeq() latestMsgSeq: topic.maxMsgSeq(),
typingIndicator: false
}); });
if (topic.isNewMessage(msg.seq)) { if (topic.isNewMessage(msg.seq)) {
@@ -3289,9 +3291,8 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
case 'kp': case 'kp':
{ {
clearTimeout(this.keyPressTimer); clearTimeout(this.keyPressTimer);
var instance = this; this.keyPressTimer = setTimeout(() => {
this.keyPressTimer = setTimeout(function () { this.setState({
instance.setState({
typingIndicator: false typingIndicator: false
}); });
}, _config_js__WEBPACK_IMPORTED_MODULE_14__.KEYPRESS_DELAY + 1000); }, _config_js__WEBPACK_IMPORTED_MODULE_14__.KEYPRESS_DELAY + 1000);
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long