Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class PressableWithSecondaryInteraction extends Component {
*/
executeSecondaryInteractionOnContextMenu(e) {
e.stopPropagation();
if (this.props.preventDefaultContentMenu) {
if (this.props.preventDefaultContextMenu) {
e.preventDefault();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const propTypes = {
forwardedRef: PropTypes.func,

/** Prevent the default ContextMenu on web/Desktop */
preventDefaultContentMenu: PropTypes.bool,
preventDefaultContextMenu: PropTypes.bool,

/** Use Text instead of Pressable to create inline layout.
* It has few limitations in comparison to Pressable.
Expand All @@ -40,7 +40,7 @@ const defaultProps = {
forwardedRef: () => {},
onPressIn: () => {},
onPressOut: () => {},
preventDefaultContentMenu: true,
preventDefaultContextMenu: true,
inline: false,
withoutFocusOnSecondaryInteraction: false,
};
Expand Down
8 changes: 5 additions & 3 deletions src/pages/home/report/ReportActionItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ class ReportActionItem extends Component {
* @param {Object} [event] - A press event.
*/
showPopover(event) {
// Block menu on the message being Edited
if (this.props.draftMessage) {
// Block menu on the message being Edited or if the report action item has errors
if (this.props.draftMessage || !_.isEmpty(this.props.action.errors)) {
return;
}

Expand Down Expand Up @@ -255,6 +255,7 @@ class ReportActionItem extends Component {
return <ChronosOOOListActions action={this.props.action} reportID={this.props.report.reportID} />;
}

const hasErrors = !_.isEmpty(this.props.action.errors);
const whisperedTo = lodashGet(this.props.action, 'whisperedTo', []);
const isWhisper = whisperedTo.length > 0;
const isMultipleParticipant = whisperedTo.length > 1;
Expand All @@ -268,7 +269,7 @@ class ReportActionItem extends Component {
onPressIn={() => this.props.isSmallScreenWidth && DeviceCapabilities.canUseTouchScreen() && ControlSelection.block()}
onPressOut={() => ControlSelection.unblock()}
onSecondaryInteraction={this.showPopover}
preventDefaultContentMenu={!this.props.draftMessage}
preventDefaultContextMenu={!this.props.draftMessage && !hasErrors}
withoutFocusOnSecondaryInteraction
>
<Hoverable>
Expand Down Expand Up @@ -343,6 +344,7 @@ class ReportActionItem extends Component {
isVisible={
hovered
&& !this.props.draftMessage
&& !hasErrors
}
draftMessage={this.props.draftMessage}
isChronosReport={ReportUtils.chatIncludesChronos(this.props.report)}
Expand Down