From 324cff6e99d5b070915d56a85e12ba6c57fe6b8b Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Tue, 26 Mar 2024 11:19:47 +0700 Subject: [PATCH 1/3] Fix can not focus on the main composer after going back from thread --- .../ComposerWithSuggestions/ComposerWithSuggestions.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index 2f9daa117273..e089f6dd2186 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -653,6 +653,8 @@ function ComposerWithSuggestions( const unsubscribeNavigationBlur = navigation.addListener('blur', () => KeyDownListener.removeKeyDownPressListener(focusComposerOnKeyPress)); const unsubscribeNavigationFocus = navigation.addListener('focus', () => { KeyDownListener.addKeyDownPressListener(focusComposerOnKeyPress); + // @ts-expect-error need to reassign this ref + ReportActionComposeFocusManager.composerRef.current = textInputRef.current; setUpComposeFocusManager(); }); KeyDownListener.addKeyDownPressListener(focusComposerOnKeyPress); From 80645ad5b57662e68c18dbc0eee1689185ff59cb Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Wed, 27 Mar 2024 01:03:44 +0700 Subject: [PATCH 2/3] add explain comment --- .../ComposerWithSuggestions/ComposerWithSuggestions.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index e089f6dd2186..9cc7613f7687 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -653,6 +653,7 @@ function ComposerWithSuggestions( const unsubscribeNavigationBlur = navigation.addListener('blur', () => KeyDownListener.removeKeyDownPressListener(focusComposerOnKeyPress)); const unsubscribeNavigationFocus = navigation.addListener('focus', () => { KeyDownListener.addKeyDownPressListener(focusComposerOnKeyPress); + // The report isn't unmounted and can be focused again after going back from another report so we should update the composerRef again // @ts-expect-error need to reassign this ref ReportActionComposeFocusManager.composerRef.current = textInputRef.current; setUpComposeFocusManager(); From 240e3943a339ca0cedcc4a0436f906a58f8fe01c Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Wed, 27 Mar 2024 09:54:17 +0700 Subject: [PATCH 3/3] fix lint --- .../ComposerWithSuggestions/ComposerWithSuggestions.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index 9cc7613f7687..734a94d50d38 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -653,7 +653,7 @@ function ComposerWithSuggestions( const unsubscribeNavigationBlur = navigation.addListener('blur', () => KeyDownListener.removeKeyDownPressListener(focusComposerOnKeyPress)); const unsubscribeNavigationFocus = navigation.addListener('focus', () => { KeyDownListener.addKeyDownPressListener(focusComposerOnKeyPress); - // The report isn't unmounted and can be focused again after going back from another report so we should update the composerRef again + // The report isn't unmounted and can be focused again after going back from another report so we should update the composerRef again // @ts-expect-error need to reassign this ref ReportActionComposeFocusManager.composerRef.current = textInputRef.current; setUpComposeFocusManager();