From f02870ebae73a04da3d42897fb410e79632d4fe7 Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Mon, 4 Sep 2023 14:34:25 +0800 Subject: [PATCH 1/4] Do not show the quick action automatically --- .../ReportActionCompose.js | 27 +++---------------- 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose/ReportActionCompose.js index 6c5bc2fc8da1..96d04e713dab 100644 --- a/src/pages/home/report/ReportActionCompose/ReportActionCompose.js +++ b/src/pages/home/report/ReportActionCompose/ReportActionCompose.js @@ -4,7 +4,6 @@ import {View} from 'react-native'; import _ from 'underscore'; import lodashGet from 'lodash/get'; import {withOnyx} from 'react-native-onyx'; -import {useNavigation} from '@react-navigation/native'; import {useAnimatedRef} from 'react-native-reanimated'; import styles from '../../../../styles/styles'; import ONYXKEYS from '../../../../ONYXKEYS'; @@ -110,7 +109,6 @@ function ReportActionCompose({ isCommentEmpty: isCommentEmptyProp, }) { const {translate} = useLocalize(); - const navigation = useNavigation(); const {isMediumScreenWidth, isSmallScreenWidth} = useWindowDimensions(); const animatedRef = useAnimatedRef(); const actionButtonRef = useRef(null); @@ -288,30 +286,11 @@ function ReportActionCompose({ setIsFocused(true); }, []); - /** - * Used to show Popover menu on Workspace chat at first sign-in - * @returns {Boolean} - */ - const showPopoverMenu = useCallback(() => { - setMenuVisibility(true); - return true; - }, []); - useEffect(() => { - // Shows Popover Menu on Workspace Chat at first sign-in - if (!disabled) { - Welcome.show({ - routes: lodashGet(navigation.getState(), 'routes', []), - showPopoverMenu, - }); + if (!EmojiPickerActions.isActive(report.reportID)) { + return; } - - return () => { - if (!EmojiPickerActions.isActive(report.reportID)) { - return; - } - EmojiPickerActions.hideEmojiPicker(); - }; + EmojiPickerActions.hideEmojiPicker(); // eslint-disable-next-line react-hooks/exhaustive-deps }, []); From 0863e6e127402a8333955879dcf18d7d5560212d Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Mon, 4 Sep 2023 14:52:34 +0800 Subject: [PATCH 2/4] Fix lint --- src/pages/home/report/ReportActionCompose/ReportActionCompose.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/home/report/ReportActionCompose/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose/ReportActionCompose.js index 96d04e713dab..706e58e99668 100644 --- a/src/pages/home/report/ReportActionCompose/ReportActionCompose.js +++ b/src/pages/home/report/ReportActionCompose/ReportActionCompose.js @@ -27,7 +27,6 @@ import ExceededCommentLength from '../../../../components/ExceededCommentLength' import ReportDropUI from '../ReportDropUI'; import reportPropTypes from '../../../reportPropTypes'; import OfflineWithFeedback from '../../../../components/OfflineWithFeedback'; -import * as Welcome from '../../../../libs/actions/Welcome'; import SendButton from './SendButton'; import AttachmentPickerWithMenuItems from './AttachmentPickerWithMenuItems'; import ComposerWithSuggestions from './ComposerWithSuggestions'; From 885d340a74508ab6fa35e1a8fabc82eb283b5cb2 Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Mon, 4 Sep 2023 16:09:42 +0800 Subject: [PATCH 3/4] Only run the use effect on unmount --- .../ReportActionCompose/ReportActionCompose.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose/ReportActionCompose.js index 706e58e99668..56ba3ee62862 100644 --- a/src/pages/home/report/ReportActionCompose/ReportActionCompose.js +++ b/src/pages/home/report/ReportActionCompose/ReportActionCompose.js @@ -285,13 +285,17 @@ function ReportActionCompose({ setIsFocused(true); }, []); - useEffect(() => { - if (!EmojiPickerActions.isActive(report.reportID)) { - return; - } - EmojiPickerActions.hideEmojiPicker(); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); + // We are returning a callback here as we want to incoke the method on unmount only + useEffect( + () => () => { + if (!EmojiPickerActions.isActive(report.reportID)) { + return; + } + EmojiPickerActions.hideEmojiPicker(); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, + [], + ); const reportRecipientAcountIDs = ReportUtils.getReportRecipientAccountIDs(report, currentUserPersonalDetails.accountID); const reportRecipient = personalDetails[reportRecipientAcountIDs[0]]; From d395fdf87e3c5dc74e3860cc0e8c78c4c6d88cfe Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Mon, 4 Sep 2023 16:36:59 +0800 Subject: [PATCH 4/4] Fix lint --- .../home/report/ReportActionCompose/ReportActionCompose.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/report/ReportActionCompose/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose/ReportActionCompose.js index 56ba3ee62862..c7517977aa27 100644 --- a/src/pages/home/report/ReportActionCompose/ReportActionCompose.js +++ b/src/pages/home/report/ReportActionCompose/ReportActionCompose.js @@ -292,8 +292,8 @@ function ReportActionCompose({ return; } EmojiPickerActions.hideEmojiPicker(); - // eslint-disable-next-line react-hooks/exhaustive-deps }, + // eslint-disable-next-line react-hooks/exhaustive-deps [], );