diff --git a/src/components/AnchorForCommentsOnly/BaseAnchorForCommentsOnly/index.js b/src/components/AnchorForCommentsOnly/BaseAnchorForCommentsOnly/index.js index 4683d9534e7a..dab9d2ea718f 100644 --- a/src/components/AnchorForCommentsOnly/BaseAnchorForCommentsOnly/index.js +++ b/src/components/AnchorForCommentsOnly/BaseAnchorForCommentsOnly/index.js @@ -10,6 +10,7 @@ import * as ReportActionContextMenu from '../../../pages/home/report/ContextMenu import * as ContextMenuActions from '../../../pages/home/report/ContextMenu/ContextMenuActions'; import AttachmentView from '../../AttachmentView'; import fileDownload from '../../../libs/fileDownload'; +import Tooltip from '../../Tooltip'; import canUseTouchScreen from '../../../libs/canUseTouchscreen'; import styles from '../../../styles/styles'; @@ -74,20 +75,22 @@ class BaseAnchorForCommentsOnly extends React.Component { } } > - linkRef = el} - style={StyleSheet.flatten([this.props.style, defaultTextStyle])} - accessibilityRole="link" - href={this.props.href} - hrefAttrs={{ - rel: this.props.rel, - target: this.props.target, - }} - // eslint-disable-next-line react/jsx-props-no-spreading - {...rest} - > - {this.props.children} - + + linkRef = el} + style={StyleSheet.flatten([this.props.style, defaultTextStyle])} + accessibilityRole="link" + href={this.props.href} + hrefAttrs={{ + rel: this.props.rel, + target: this.props.target, + }} + // eslint-disable-next-line react/jsx-props-no-spreading + {...rest} + > + {this.props.children} + + ) ); diff --git a/src/components/ContextMenuItem.js b/src/components/ContextMenuItem.js index 58b361fca823..339e36afd6eb 100644 --- a/src/components/ContextMenuItem.js +++ b/src/components/ContextMenuItem.js @@ -29,6 +29,9 @@ const propTypes = { /** Automatically reset the success status */ autoReset: PropTypes.bool, + + /** A description text to show under the title */ + description: PropTypes.string, }; const defaultProps = { @@ -36,6 +39,7 @@ const defaultProps = { successIcon: null, successText: '', autoReset: false, + description: '', }; class ContextMenuItem extends Component { @@ -109,6 +113,7 @@ class ContextMenuItem extends Component { onPress={this.triggerPressAndUpdateSuccess} wrapperStyle={styles.pr9} success={this.state.success} + description={this.props.description} /> ) ); diff --git a/src/components/MenuItem.js b/src/components/MenuItem.js index 6c5c20eb008e..9e40683893ba 100644 --- a/src/components/MenuItem.js +++ b/src/components/MenuItem.js @@ -59,7 +59,7 @@ const MenuItem = props => ( > {({hovered, pressed}) => ( <> - + {(props.icon && props.iconType === CONST.ICON_TYPE_ICON) && ( ( /> )} - + ( > {props.title} - {props.description && ( - + {Boolean(props.description) && ( + {props.description} )} diff --git a/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.js b/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.js index 98bcc5dca80d..ea0b478aaf63 100755 --- a/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.js +++ b/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.js @@ -10,12 +10,15 @@ import { } from './genericReportActionContextMenuPropTypes'; import withLocalize, {withLocalizePropTypes} from '../../../../components/withLocalize'; import ContextMenuActions, {CONTEXT_MENU_TYPES} from './ContextMenuActions'; +import compose from '../../../../libs/compose'; +import withWindowDimensions, {windowDimensionsPropTypes} from '../../../../components/withWindowDimensions'; const propTypes = { /** String representing the context menu type [LINK, REPORT_ACTION] which controls context menu choices */ type: PropTypes.string, ...genericReportActionContextMenuPropTypes, ...withLocalizePropTypes, + ...windowDimensionsPropTypes, }; const defaultProps = { @@ -49,6 +52,7 @@ class BaseReportActionContextMenu extends React.Component { draftMessage: this.props.draftMessage, selection: this.props.selection, })} + description={contextAction.getDescription(this.props.selection, this.props.isSmallScreenWidth)} /> ))} @@ -59,4 +63,7 @@ class BaseReportActionContextMenu extends React.Component { BaseReportActionContextMenu.propTypes = propTypes; BaseReportActionContextMenu.defaultProps = defaultProps; -export default withLocalize(BaseReportActionContextMenu); +export default compose( + withLocalize, + withWindowDimensions, +)(BaseReportActionContextMenu); diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.js b/src/pages/home/report/ContextMenu/ContextMenuActions.js index 099ee746b9c9..ec14d63b88b5 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.js +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.js @@ -11,6 +11,7 @@ import CONST from '../../../../CONST'; import getAttachmentDetails from '../../../../libs/fileDownload/getAttachmentDetails'; import fileDownload from '../../../../libs/fileDownload'; import addEncryptedAuthTokenToURL from '../../../../libs/addEncryptedAuthTokenToURL'; +import * as ContextMenuUtils from './ContextMenuUtils'; /** * Gets the HTML version of the message in an action. @@ -51,6 +52,7 @@ export default [ sourceURL = addEncryptedAuthTokenToURL(sourceURL); fileDownload(sourceURL, originalFileName); }, + getDescription: () => {}, }, { textTranslateKey: 'reportActionContextMenu.copyURLToClipboard', @@ -62,6 +64,7 @@ export default [ Clipboard.setString(selection); hideContextMenu(true, ReportActionComposeFocusManager.focus); }, + getDescription: ContextMenuUtils.getPopoverDescription, }, { textTranslateKey: 'reportActionContextMenu.copyEmailToClipboard', @@ -73,6 +76,7 @@ export default [ Clipboard.setString(selection.replace('mailto:', '')); hideContextMenu(true, ReportActionComposeFocusManager.focus); }, + getDescription: () => {}, }, { textTranslateKey: 'reportActionContextMenu.copyToClipboard', @@ -107,6 +111,7 @@ export default [ hideContextMenu(true, ReportActionComposeFocusManager.focus); } }, + getDescription: () => {}, }, { @@ -114,6 +119,7 @@ export default [ icon: Expensicons.LinkCopy, shouldShow: () => false, onPress: () => {}, + getDescription: () => {}, }, { @@ -128,6 +134,7 @@ export default [ hideContextMenu(true, ReportActionComposeFocusManager.focus); } }, + getDescription: () => {}, }, { @@ -152,6 +159,7 @@ export default [ // No popover to hide, call editAction immediately editAction(); }, + getDescription: () => {}, }, { textTranslateKey: 'reportActionContextMenu.deleteComment', @@ -171,6 +179,7 @@ export default [ // No popover to hide, call showDeleteConfirmModal immediately showDeleteModal(reportID, reportAction); }, + getDescription: () => {}, }, ]; diff --git a/src/pages/home/report/ContextMenu/ContextMenuUtils/index.js b/src/pages/home/report/ContextMenu/ContextMenuUtils/index.js new file mode 100644 index 000000000000..f694f413e29a --- /dev/null +++ b/src/pages/home/report/ContextMenu/ContextMenuUtils/index.js @@ -0,0 +1,17 @@ +/* eslint-disable import/prefer-default-export */ + +/** + * The popover description will be an empty string on anything but mobile web + * because we show link in tooltip instead of popover on web + * + * @param {String} selection + * @param {Boolean} isSmallScreenWidth + * @returns {String} + */ +function getPopoverDescription(selection, isSmallScreenWidth) { + return isSmallScreenWidth ? selection : ''; +} + +export { + getPopoverDescription, +}; diff --git a/src/pages/home/report/ContextMenu/ContextMenuUtils/index.native.js b/src/pages/home/report/ContextMenu/ContextMenuUtils/index.native.js new file mode 100644 index 000000000000..3dbf81926098 --- /dev/null +++ b/src/pages/home/report/ContextMenu/ContextMenuUtils/index.native.js @@ -0,0 +1,15 @@ +/* eslint-disable import/prefer-default-export */ + +/** + * Always show popover description on native platforms + * + * @param {String} selection + * @returns {String} + */ +function getPopoverDescription(selection) { + return selection; +} + +export { + getPopoverDescription, +}; diff --git a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js index bb2668573d70..b77599ad9bea 100644 --- a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js +++ b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js @@ -285,7 +285,7 @@ class PopoverReportActionContextMenu extends React.Component { animationOutTiming={1} measureContent={this.measureContent} shouldSetModalVisibility={false} - fullscreen={false} + fullscreen >