Skip to content

Commit

Permalink
Merge pull request #27268 from tienifr/fix/26178
Browse files Browse the repository at this point in the history
fix: 26178 Context menu does not close after user goes to the previous page
  • Loading branch information
youssef-lr authored Sep 19, 2023
2 parents 1127be9 + e3c8200 commit 436b75d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/libs/Navigation/NavigationRoot.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import Log from '../Log';
import StatusBar from '../StatusBar';
import useCurrentReportID from '../../hooks/useCurrentReportID';
import useWindowDimensions from '../../hooks/useWindowDimensions';
import * as ReportActionContextMenu from '../../pages/home/report/ContextMenu/ReportActionContextMenu';
import * as EmojiPickerAction from '../actions/EmojiPickerAction';

// https://reactnavigation.org/docs/themes
const navigationTheme = {
Expand Down Expand Up @@ -121,6 +123,10 @@ function NavigationRoot(props) {
if (!state) {
return;
}
ReportActionContextMenu.hideContextMenu();
ReportActionContextMenu.hideDeleteModal();
EmojiPickerAction.hideEmojiPicker(true);

updateCurrentReportID(state);
parseAndLogRoute(state);
animateStatusBarBackgroundColor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@ class BasePopoverReactionList extends React.Component {
* Hide the ReactionList modal popover.
*/
hideReactionList() {
if (!this.state.isPopoverVisible) {
return;
}
this.setState({
isPopoverVisible: false,
});
Expand Down
7 changes: 7 additions & 0 deletions src/pages/home/report/ReportActionsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ function ReportActionsView(props) {
}
}, [props.report, didSubscribeToReportTypingEvents, reportID]);

useEffect(() => {
if (isFocused || !context.reactionListRef || !context.reactionListRef.current) {
return;
}
context.reactionListRef.current.hideReactionList();
}, [isFocused, context.reactionListRef]);

/**
* Retrieves the next set of report actions for the chat once we are nearing the end of what we are currently
* displaying.
Expand Down

0 comments on commit 436b75d

Please sign in to comment.