Skip to content

Commit 436b75d

Browse files
authored
Merge pull request #27268 from tienifr/fix/26178
fix: 26178 Context menu does not close after user goes to the previous page
2 parents 1127be9 + e3c8200 commit 436b75d

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

src/libs/Navigation/NavigationRoot.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import Log from '../Log';
1111
import StatusBar from '../StatusBar';
1212
import useCurrentReportID from '../../hooks/useCurrentReportID';
1313
import useWindowDimensions from '../../hooks/useWindowDimensions';
14+
import * as ReportActionContextMenu from '../../pages/home/report/ContextMenu/ReportActionContextMenu';
15+
import * as EmojiPickerAction from '../actions/EmojiPickerAction';
1416

1517
// https://reactnavigation.org/docs/themes
1618
const navigationTheme = {
@@ -121,6 +123,10 @@ function NavigationRoot(props) {
121123
if (!state) {
122124
return;
123125
}
126+
ReportActionContextMenu.hideContextMenu();
127+
ReportActionContextMenu.hideDeleteModal();
128+
EmojiPickerAction.hideEmojiPicker(true);
129+
124130
updateCurrentReportID(state);
125131
parseAndLogRoute(state);
126132
animateStatusBarBackgroundColor();

src/pages/home/report/ReactionList/PopoverReactionList/BasePopoverReactionList.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,9 @@ class BasePopoverReactionList extends React.Component {
198198
* Hide the ReactionList modal popover.
199199
*/
200200
hideReactionList() {
201+
if (!this.state.isPopoverVisible) {
202+
return;
203+
}
201204
this.setState({
202205
isPopoverVisible: false,
203206
});

src/pages/home/report/ReportActionsView.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,13 @@ function ReportActionsView(props) {
132132
}
133133
}, [props.report, didSubscribeToReportTypingEvents, reportID]);
134134

135+
useEffect(() => {
136+
if (isFocused || !context.reactionListRef || !context.reactionListRef.current) {
137+
return;
138+
}
139+
context.reactionListRef.current.hideReactionList();
140+
}, [isFocused, context.reactionListRef]);
141+
135142
/**
136143
* Retrieves the next set of report actions for the chat once we are nearing the end of what we are currently
137144
* displaying.

0 commit comments

Comments
 (0)