Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not show the quick action in workspace chat automatically #26636

Merged
merged 4 commits into from
Sep 4, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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';
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -288,30 +285,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)) {
Copy link
Contributor

@MonilBhavsar MonilBhavsar Sep 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block i.e. useEffect without dependencies was working similar to componentWillUnmount, I think.
We should keep it in return () to maintain the previous behavior?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested the emoji picker and the behaviour is still the same

return;
}

return () => {
if (!EmojiPickerActions.isActive(report.reportID)) {
return;
}
EmojiPickerActions.hideEmojiPicker();
};
EmojiPickerActions.hideEmojiPicker();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

Expand Down