diff --git a/src/pages/home/report/ReportActionCompose/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose/ReportActionCompose.js index 6c5bc2fc8da1..c7517977aa27 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'; @@ -28,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'; @@ -110,7 +108,6 @@ function ReportActionCompose({ isCommentEmpty: isCommentEmptyProp, }) { const {translate} = useLocalize(); - const navigation = useNavigation(); const {isMediumScreenWidth, isSmallScreenWidth} = useWindowDimensions(); const animatedRef = useAnimatedRef(); const actionButtonRef = useRef(null); @@ -288,32 +285,17 @@ 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, - }); - } - - return () => { + // 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]];