From d41c300348494b4e6589e4f3305aa7eb5ffe2b79 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Mon, 28 Aug 2023 18:49:36 +0530 Subject: [PATCH] use focus() --- .../ReportActionCompose/ReportActionCompose.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose/ReportActionCompose.js index 523f98264f34..9f5484ac8e07 100644 --- a/src/pages/home/report/ReportActionCompose/ReportActionCompose.js +++ b/src/pages/home/report/ReportActionCompose/ReportActionCompose.js @@ -183,7 +183,7 @@ function ReportActionCompose({ if (!isKeyboardVisibleWhenShowingModalRef.current) { return; } - composerRef.current.focus(true); + focus(); isKeyboardVisibleWhenShowingModalRef.current = false; }, []); @@ -270,6 +270,12 @@ function ReportActionCompose({ isNextModalWillOpenRef.current = true; }, []); + const focus = () => { + if (composerRef === null || composerRef.current === null) { + return; + } + composerRef.current.focus(true); + } const onBlur = useCallback((e) => { setIsFocused(false); suggestionsRef.current.resetSuggestions(); @@ -403,12 +409,7 @@ function ReportActionCompose({ {DeviceCapabilities.canUseTouchScreen() && isMediumScreenWidth ? null : ( { - if (composerRef === null || composerRef.current === null) { - return; - } - composerRef.current.focus(true); - }} + onModalHide={focus} onEmojiSelected={(...args) => composerRef.current.replaceSelectionWithText(...args)} emojiPickerID={report.reportID} />