diff --git a/src/pages/home/report/ReportActionContextMenu.js b/src/pages/home/report/ReportActionContextMenu.js index 8f4079dc0d79..bd4ee0bc481d 100755 --- a/src/pages/home/report/ReportActionContextMenu.js +++ b/src/pages/home/report/ReportActionContextMenu.js @@ -60,6 +60,7 @@ class ReportActionContextMenu extends React.Component { this.confirmDeleteAndHideModal = this.confirmDeleteAndHideModal.bind(this); this.hideDeleteConfirmModal = this.hideDeleteConfirmModal.bind(this); this.getActionText = this.getActionText.bind(this); + this.hidePopover = this.hidePopover.bind(this); // A list of all the context actions in this menu. this.contextActions = [ @@ -86,6 +87,7 @@ class ReportActionContextMenu extends React.Component { } else { Clipboard.setString(html); } + this.hidePopover(true); }, }, @@ -104,6 +106,7 @@ class ReportActionContextMenu extends React.Component { onPress: () => { updateLastReadActionID(this.props.reportID, this.props.reportAction.sequenceNumber); setNewMarkerPosition(this.props.reportID, this.props.reportAction.sequenceNumber); + this.hidePopover(true); }, }, @@ -112,7 +115,7 @@ class ReportActionContextMenu extends React.Component { icon: Pencil, shouldShow: () => canEditReportAction(this.props.reportAction), onPress: () => { - this.props.hidePopover(); + this.hidePopover(); saveReportActionDraft( this.props.reportID, this.props.reportAction.reportActionID, @@ -124,7 +127,9 @@ class ReportActionContextMenu extends React.Component { text: this.props.translate('reportActionContextMenu.deleteComment'), icon: Trashcan, shouldShow: () => canEditReportAction(this.props.reportAction), - onPress: () => this.setState({isDeleteCommentConfirmModalVisible: true}), + onPress: () => { + this.setState({isDeleteCommentConfirmModalVisible: true}); + }, }, ]; @@ -148,10 +153,26 @@ class ReportActionContextMenu extends React.Component { confirmDeleteAndHideModal() { deleteReportComment(this.props.reportID, this.props.reportAction); this.setState({isDeleteCommentConfirmModalVisible: false}); + this.hidePopover(); } hideDeleteConfirmModal() { this.setState({isDeleteCommentConfirmModalVisible: false}); + this.hidePopover(); + } + + /** + * Hides the popover menu with an optional delay + * + * @param {Boolean} shouldDelay whether the menu should close after a delay + * @memberof ReportActionContextMenu + */ + hidePopover(shouldDelay) { + if (!shouldDelay) { + this.props.hidePopover(); + return; + } + setTimeout(this.props.hidePopover, 800); } render() {