From 1e798506fc1daceedf131ac66188d156070a7653 Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Fri, 20 Aug 2021 14:28:52 +0100 Subject: [PATCH 1/2] Update the comment in text input manually in componentUpdate --- src/pages/home/report/ReportActionCompose.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pages/home/report/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose.js index 38eedffa1780..884ac0c196e7 100755 --- a/src/pages/home/report/ReportActionCompose.js +++ b/src/pages/home/report/ReportActionCompose.js @@ -188,6 +188,12 @@ class ReportActionCompose extends React.Component { && prevProps.modal.isVisible && !this.props.modal.isVisible) { this.focus(); } + + // If we switch from a sidebar, the component does not mount again + // so we need to update the comment manually. + if (prevProps.comment !== this.props.comment && this.textInput) { + this.textInput.setNativeProps({text: this.props.comment}); + } } componentWillUnmount() { From 9135cfb5334b5bc3e5b9621e5e461861b446e4c7 Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Fri, 20 Aug 2021 14:57:02 +0100 Subject: [PATCH 2/2] Remove unnecessary check --- src/pages/home/report/ReportActionCompose.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/report/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose.js index 884ac0c196e7..9a9346e2188b 100755 --- a/src/pages/home/report/ReportActionCompose.js +++ b/src/pages/home/report/ReportActionCompose.js @@ -191,7 +191,7 @@ class ReportActionCompose extends React.Component { // If we switch from a sidebar, the component does not mount again // so we need to update the comment manually. - if (prevProps.comment !== this.props.comment && this.textInput) { + if (prevProps.comment !== this.props.comment) { this.textInput.setNativeProps({text: this.props.comment}); } }