Skip to content

Commit

Permalink
Merge pull request #21962 from ginsuma/fix/21678
Browse files Browse the repository at this point in the history
Focus the composer again after going back from a report not found
  • Loading branch information
Julesssss authored Jul 4, 2023
2 parents fa82817 + 294df97 commit 900b328
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/pages/home/report/ReportActionCompose.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,14 @@ class ReportActionCompose extends React.Component {
this.focus(false);
});

// This listener is used for focusing the composer again after going back to a report without remounting it.
this.unsubscribeNavFocus = this.props.navigation.addListener('focus', () => {
if (!this.willBlurTextInputOnTapOutside || this.props.isFocused || this.props.modal.isVisible) {
return;
}
this.focus();
});

this.updateComment(this.comment);

// Shows Popover Menu on Workspace Chat at first sign-in
Expand Down Expand Up @@ -274,6 +282,10 @@ class ReportActionCompose extends React.Component {

componentWillUnmount() {
ReportActionComposeFocusManager.clear();
if (!this.unsubscribeNavFocus) {
return;
}
this.unsubscribeNavFocus();
}

onSelectionChange(e) {
Expand Down

0 comments on commit 900b328

Please sign in to comment.