From 37520c4bc90c6862a359931c2541f722ae981f71 Mon Sep 17 00:00:00 2001 From: tienifr Date: Wed, 12 Jul 2023 11:32:31 +0700 Subject: [PATCH] fix: composer does not refocus on clicking the same chat --- src/components/LHNOptionsList/OptionRowLHN.js | 8 ++++++++ src/pages/home/sidebar/SidebarLinks.js | 9 +++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/components/LHNOptionsList/OptionRowLHN.js b/src/components/LHNOptionsList/OptionRowLHN.js index 267d357032b0..affee206701c 100644 --- a/src/components/LHNOptionsList/OptionRowLHN.js +++ b/src/components/LHNOptionsList/OptionRowLHN.js @@ -147,6 +147,14 @@ function OptionRowLHN(props) { props.onSelectRow(optionItem, popoverAnchor); }} + onMouseDown={(e) => { + if (!e) { + return; + } + + // Prevent losing Composer focus + e.preventDefault(); + }} onSecondaryInteraction={(e) => showPopover(e)} withoutFocusOnSecondaryInteraction activeOpacity={0.8} diff --git a/src/pages/home/sidebar/SidebarLinks.js b/src/pages/home/sidebar/SidebarLinks.js index 4142334d1be2..2fd9e9a29799 100644 --- a/src/pages/home/sidebar/SidebarLinks.js +++ b/src/pages/home/sidebar/SidebarLinks.js @@ -185,10 +185,11 @@ class SidebarLinks extends React.Component { * @param {String} option.reportID */ showReportPage(option) { - if (this.props.isCreateMenuOpen || (this.props.isSmallScreenWidth && Navigation.getTopmostReportId())) { - // Prevent opening Report page when click LHN row quickly after clicking FAB icon - // or when continuously click different LHNs, only apply to small screen since - // getTopmostReportId always returns on other devices + // Prevent opening Report page when clicking LHN row quickly after clicking FAB icon + // or when clicking the active LHN row + // or when continuously clicking different LHNs, only apply to small screen + // since getTopmostReportId always returns on other devices + if (this.props.isCreateMenuOpen || this.props.currentReportID === option.reportID || (this.props.isSmallScreenWidth && Navigation.getTopmostReportId())) { return; } Navigation.navigate(ROUTES.getReportRoute(option.reportID));