From 8fc67b50c96e6cb0446c0a611373062b9eb25e7d Mon Sep 17 00:00:00 2001 From: tienifr Date: Tue, 12 Sep 2023 23:02:06 +0700 Subject: [PATCH 1/5] fix: 26178 Context menu does not close after user goes to the previous page --- src/libs/Navigation/NavigationRoot.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libs/Navigation/NavigationRoot.js b/src/libs/Navigation/NavigationRoot.js index d8cb96e2c6b3..f50aa6e17068 100644 --- a/src/libs/Navigation/NavigationRoot.js +++ b/src/libs/Navigation/NavigationRoot.js @@ -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 = { @@ -121,6 +123,10 @@ function NavigationRoot(props) { if (!state) { return; } + ReportActionContextMenu.hideContextMenu(); + ReportActionContextMenu.hideDeleteModal(); + EmojiPickerAction.hideEmojiPicker(true); + updateCurrentReportID(state); parseAndLogRoute(state); animateStatusBarBackgroundColor(); From 7b841ff6bd3b628329552cf1a5e80179f624433f Mon Sep 17 00:00:00 2001 From: tienifr Date: Tue, 12 Sep 2023 23:14:49 +0700 Subject: [PATCH 2/5] fix lint --- src/libs/Navigation/NavigationRoot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/Navigation/NavigationRoot.js b/src/libs/Navigation/NavigationRoot.js index f50aa6e17068..9e3cad6144dd 100644 --- a/src/libs/Navigation/NavigationRoot.js +++ b/src/libs/Navigation/NavigationRoot.js @@ -12,7 +12,7 @@ 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"; +import * as EmojiPickerAction from '../actions/EmojiPickerAction'; // https://reactnavigation.org/docs/themes const navigationTheme = { From 011a2a7d11154d78405a1d38843c2e591a2d74c3 Mon Sep 17 00:00:00 2001 From: tienifr Date: Thu, 14 Sep 2023 12:22:36 +0700 Subject: [PATCH 3/5] fix: hide emoji modal --- .../PopoverReactionList/BasePopoverReactionList.js | 3 +++ src/pages/home/report/ReportActionsView.js | 14 +++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/pages/home/report/ReactionList/PopoverReactionList/BasePopoverReactionList.js b/src/pages/home/report/ReactionList/PopoverReactionList/BasePopoverReactionList.js index 9303d7a5bc39..a721ab31b78e 100644 --- a/src/pages/home/report/ReactionList/PopoverReactionList/BasePopoverReactionList.js +++ b/src/pages/home/report/ReactionList/PopoverReactionList/BasePopoverReactionList.js @@ -198,6 +198,9 @@ class BasePopoverReactionList extends React.Component { * Hide the ReactionList modal popover. */ hideReactionList() { + if (!this.state.isPopoverVisible) { + return; + } this.setState({ isPopoverVisible: false, }); diff --git a/src/pages/home/report/ReportActionsView.js b/src/pages/home/report/ReportActionsView.js index a694c4996438..f143199fd540 100755 --- a/src/pages/home/report/ReportActionsView.js +++ b/src/pages/home/report/ReportActionsView.js @@ -20,6 +20,7 @@ import reportPropTypes from '../../reportPropTypes'; import PopoverReactionList from './ReactionList/PopoverReactionList'; import getIsReportFullyVisible from '../../../libs/getIsReportFullyVisible'; import ReportScreenContext from '../ReportScreenContext'; +import withNavigationFocus from '../../../components/withNavigationFocus'; const propTypes = { /** The report currently being looked at */ @@ -132,6 +133,13 @@ function ReportActionsView(props) { } }, [props.report, didSubscribeToReportTypingEvents, reportID]); + useEffect(() => { + if (!props.isFocused && context.reactionListRef && context.reactionListRef.current) { + return; + } + context.reactionListRef.current.hideReactionList(); + }, [props.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. @@ -231,6 +239,10 @@ function arePropsEqual(oldProps, newProps) { return false; } + if (newProps.isFocused !== oldProps.isFocused) { + return false; + } + if (lodashGet(newProps.report, 'hasOutstandingIOU') !== lodashGet(oldProps.report, 'hasOutstandingIOU')) { return false; } @@ -284,4 +296,4 @@ function arePropsEqual(oldProps, newProps) { const MemoizedReportActionsView = React.memo(ReportActionsView, arePropsEqual); -export default compose(Performance.withRenderTrace({id: ' rendering'}), withWindowDimensions, withLocalize, withNetwork())(MemoizedReportActionsView); +export default compose(Performance.withRenderTrace({id: ' rendering'}), withNavigationFocus, withWindowDimensions, withLocalize, withNetwork())(MemoizedReportActionsView); From 933b72b2d50f530de43f1e9d27bce7474793dd90 Mon Sep 17 00:00:00 2001 From: tienifr Date: Fri, 15 Sep 2023 10:31:07 +0700 Subject: [PATCH 4/5] remove HOC --- src/pages/home/report/ReportActionsView.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/pages/home/report/ReportActionsView.js b/src/pages/home/report/ReportActionsView.js index f143199fd540..e693a0714b64 100755 --- a/src/pages/home/report/ReportActionsView.js +++ b/src/pages/home/report/ReportActionsView.js @@ -20,7 +20,6 @@ import reportPropTypes from '../../reportPropTypes'; import PopoverReactionList from './ReactionList/PopoverReactionList'; import getIsReportFullyVisible from '../../../libs/getIsReportFullyVisible'; import ReportScreenContext from '../ReportScreenContext'; -import withNavigationFocus from '../../../components/withNavigationFocus'; const propTypes = { /** The report currently being looked at */ @@ -134,11 +133,11 @@ function ReportActionsView(props) { }, [props.report, didSubscribeToReportTypingEvents, reportID]); useEffect(() => { - if (!props.isFocused && context.reactionListRef && context.reactionListRef.current) { + if (!isFocused && context.reactionListRef && context.reactionListRef.current) { return; } context.reactionListRef.current.hideReactionList(); - }, [props.isFocused, context.reactionListRef]); + }, [isFocused, context.reactionListRef]); /** * Retrieves the next set of report actions for the chat once we are nearing the end of what we are currently @@ -239,10 +238,6 @@ function arePropsEqual(oldProps, newProps) { return false; } - if (newProps.isFocused !== oldProps.isFocused) { - return false; - } - if (lodashGet(newProps.report, 'hasOutstandingIOU') !== lodashGet(oldProps.report, 'hasOutstandingIOU')) { return false; } @@ -296,4 +291,4 @@ function arePropsEqual(oldProps, newProps) { const MemoizedReportActionsView = React.memo(ReportActionsView, arePropsEqual); -export default compose(Performance.withRenderTrace({id: ' rendering'}), withNavigationFocus, withWindowDimensions, withLocalize, withNetwork())(MemoizedReportActionsView); +export default compose(Performance.withRenderTrace({id: ' rendering'}), withWindowDimensions, withLocalize, withNetwork())(MemoizedReportActionsView); From e3c82002d322b9945c96a54f869dc40eb66cca21 Mon Sep 17 00:00:00 2001 From: tienifr Date: Fri, 15 Sep 2023 22:59:00 +0700 Subject: [PATCH 5/5] fix early return condition --- src/pages/home/report/ReportActionsView.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/report/ReportActionsView.js b/src/pages/home/report/ReportActionsView.js index e693a0714b64..fb0f10298537 100755 --- a/src/pages/home/report/ReportActionsView.js +++ b/src/pages/home/report/ReportActionsView.js @@ -133,7 +133,7 @@ function ReportActionsView(props) { }, [props.report, didSubscribeToReportTypingEvents, reportID]); useEffect(() => { - if (!isFocused && context.reactionListRef && context.reactionListRef.current) { + if (isFocused || !context.reactionListRef || !context.reactionListRef.current) { return; } context.reactionListRef.current.hideReactionList();