From 47981ef68b5a6647f0e04fb22d62c3200b3ca6e6 Mon Sep 17 00:00:00 2001 From: christianwen Date: Mon, 30 Dec 2024 16:22:41 +0700 Subject: [PATCH 1/5] Composer is blocked by keyboard after changing payment method or backgrounding app --- .../ComposerWithSuggestions/ComposerWithSuggestions.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index b56109b64c40..0e9249eea04c 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -648,6 +648,12 @@ function ComposerWithSuggestions( focus(true); }, [focus, prevIsFocused, editFocused, prevIsModalVisible, isFocused, modal?.isVisible, isNextModalWillOpenRef, shouldAutoFocus]); + useEffect(()=>{ + if(prevIsModalVisible && !modal?.isVisible && !showSoftInputOnFocus){ + setShowSoftInputOnFocus(true); + } + },[modal?.isVisible, prevIsModalVisible, showSoftInputOnFocus]) + useEffect(() => { // Scrolls the composer to the bottom and sets the selection to the end, so that longer drafts are easier to edit updateMultilineInputRange(textInputRef.current, !!shouldAutoFocus); From 0ad30650ab790fbe4dd8a33924c40b41f74de331 Mon Sep 17 00:00:00 2001 From: christianwen Date: Mon, 30 Dec 2024 17:09:36 +0700 Subject: [PATCH 2/5] show soft keyboard when refocus --- .../ComposerWithSuggestions/ComposerWithSuggestions.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index 0e9249eea04c..a4905e45ba82 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -649,10 +649,10 @@ function ComposerWithSuggestions( }, [focus, prevIsFocused, editFocused, prevIsModalVisible, isFocused, modal?.isVisible, isNextModalWillOpenRef, shouldAutoFocus]); useEffect(()=>{ - if(prevIsModalVisible && !modal?.isVisible && !showSoftInputOnFocus){ + if(prevIsFocused && !isFocused && !showSoftInputOnFocus){ setShowSoftInputOnFocus(true); } - },[modal?.isVisible, prevIsModalVisible, showSoftInputOnFocus]) + },[isFocused, prevIsFocused, showSoftInputOnFocus]) useEffect(() => { // Scrolls the composer to the bottom and sets the selection to the end, so that longer drafts are easier to edit From 3351e318f937467b38d262f197a5b81c92e9c0a2 Mon Sep 17 00:00:00 2001 From: christianwen Date: Mon, 30 Dec 2024 17:21:32 +0700 Subject: [PATCH 3/5] lint fix --- .../ComposerWithSuggestions/ComposerWithSuggestions.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index a4905e45ba82..53c7280523db 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -648,11 +648,11 @@ function ComposerWithSuggestions( focus(true); }, [focus, prevIsFocused, editFocused, prevIsModalVisible, isFocused, modal?.isVisible, isNextModalWillOpenRef, shouldAutoFocus]); - useEffect(()=>{ - if(prevIsFocused && !isFocused && !showSoftInputOnFocus){ + useEffect(() => { + if (prevIsFocused && !isFocused && !showSoftInputOnFocus) { setShowSoftInputOnFocus(true); } - },[isFocused, prevIsFocused, showSoftInputOnFocus]) + }, [isFocused, prevIsFocused, showSoftInputOnFocus]); useEffect(() => { // Scrolls the composer to the bottom and sets the selection to the end, so that longer drafts are easier to edit From 37e6aaaacab6cb5df8356668924154b9939b8a78 Mon Sep 17 00:00:00 2001 From: christianwen Date: Mon, 30 Dec 2024 17:30:08 +0700 Subject: [PATCH 4/5] lint fix --- .../ComposerWithSuggestions/ComposerWithSuggestions.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index 53c7280523db..c440be8b5e4e 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -649,10 +649,11 @@ function ComposerWithSuggestions( }, [focus, prevIsFocused, editFocused, prevIsModalVisible, isFocused, modal?.isVisible, isNextModalWillOpenRef, shouldAutoFocus]); useEffect(() => { - if (prevIsFocused && !isFocused && !showSoftInputOnFocus) { - setShowSoftInputOnFocus(true); + if (prevIsFocused || !isFocused || showSoftInputOnFocus) { + return; } - }, [isFocused, prevIsFocused, showSoftInputOnFocus]); + setShowSoftInputOnFocus(true); + }, [isFocused, prevIsFocused, showSoftInputOnFocus, setShowSoftInputOnFocus]); useEffect(() => { // Scrolls the composer to the bottom and sets the selection to the end, so that longer drafts are easier to edit @@ -701,7 +702,7 @@ function ComposerWithSuggestions( useEffect(() => { // We use the tag to store the native ID of the text input. Later, we use it in onSelectionChange to pick up the proper text input data. - tag.set(findNodeHandle(textInputRef.current) ?? -1); + tag.set(findNodeHandle(textInputRef.current) ?? CONST.); }, [tag]); useFocusedInputHandler( From 4ceea0bc05f27470507012b1c441782cd7384fae Mon Sep 17 00:00:00 2001 From: christianwen Date: Mon, 30 Dec 2024 17:35:32 +0700 Subject: [PATCH 5/5] update default value --- .../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 c440be8b5e4e..f437b0395971 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -702,7 +702,7 @@ function ComposerWithSuggestions( useEffect(() => { // We use the tag to store the native ID of the text input. Later, we use it in onSelectionChange to pick up the proper text input data. - tag.set(findNodeHandle(textInputRef.current) ?? CONST.); + tag.set(findNodeHandle(textInputRef.current) ?? -1); }, [tag]); useFocusedInputHandler(