From 67031629d737ac5fbf5b7561e21f98ce285993d8 Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Thu, 5 Oct 2023 23:02:24 +0700 Subject: [PATCH 1/2] fix: 28926 --- src/libs/ReportActionComposeFocusManager.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libs/ReportActionComposeFocusManager.ts b/src/libs/ReportActionComposeFocusManager.ts index ca4f9d77898b..02f0836e3b3d 100644 --- a/src/libs/ReportActionComposeFocusManager.ts +++ b/src/libs/ReportActionComposeFocusManager.ts @@ -1,5 +1,7 @@ import React from 'react'; import {TextInput} from 'react-native'; +import ROUTES from '../ROUTES'; +import Navigation from './Navigation/Navigation'; type FocusCallback = () => void; @@ -28,6 +30,10 @@ function onComposerFocus(callback: FocusCallback, isMainComposer = false) { * Request focus on the ReportActionComposer */ function focus() { + if (!Navigation.isActiveRoute(ROUTES.REPORT_WITH_ID.getRoute(Navigation.getTopmostReportId() ?? ''))) { + return; + } + if (typeof focusCallback !== 'function') { if (typeof mainComposerFocusCallback !== 'function') { return; From 774396fde7cc907f4bdf75dc0362ae371ee9d9f1 Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Wed, 11 Oct 2023 14:25:23 +0700 Subject: [PATCH 2/2] add comment --- src/libs/ReportActionComposeFocusManager.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/ReportActionComposeFocusManager.ts b/src/libs/ReportActionComposeFocusManager.ts index 02f0836e3b3d..65466fa4a204 100644 --- a/src/libs/ReportActionComposeFocusManager.ts +++ b/src/libs/ReportActionComposeFocusManager.ts @@ -30,6 +30,7 @@ function onComposerFocus(callback: FocusCallback, isMainComposer = false) { * Request focus on the ReportActionComposer */ function focus() { + /** Do not trigger the refocusing when the active route is not the report route, */ if (!Navigation.isActiveRoute(ROUTES.REPORT_WITH_ID.getRoute(Navigation.getTopmostReportId() ?? ''))) { return; }