From 26830e83230e7de9cd630d7446f47eedde0cc124 Mon Sep 17 00:00:00 2001 From: Mohammad Luthfi Fathur Rahman Date: Thu, 10 Mar 2022 11:36:47 +0700 Subject: [PATCH] Send button is active when message has spaces, but does not send it --- src/pages/home/report/ReportActionCompose.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose.js index cafee70c3b85..8a0d1726b57a 100755 --- a/src/pages/home/report/ReportActionCompose.js +++ b/src/pages/home/report/ReportActionCompose.js @@ -149,6 +149,7 @@ class ReportActionCompose extends React.Component { this.focus(false); }); + this.updateComment(this.comment); } componentDidUpdate(prevProps) { @@ -307,7 +308,7 @@ class ReportActionCompose extends React.Component { updateComment(newComment) { this.textInput.setNativeProps({text: newComment}); this.setState({ - isCommentEmpty: newComment.length === 0, + isCommentEmpty: newComment.trim().length === 0, }); // Indicate that draft has been created. @@ -345,8 +346,8 @@ class ReportActionCompose extends React.Component { this.submitForm(); } - // Trigger the edit box for last sent message if ArrowUp is pressed - if (e.key === 'ArrowUp' && this.state.isCommentEmpty) { + // Trigger the edit box for last sent message if ArrowUp is pressed and the comment is empty + if (e.key === 'ArrowUp' && this.textInput.selectionStart === 0 && this.state.isCommentEmpty) { e.preventDefault(); const reportActionKey = _.find(