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 @@ -208,6 +208,7 @@ function BaseReportActionContextMenu({
undefined,
undefined,
filteredContextMenuActions,
true,
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function PopoverReportActionContextMenu(_props: never, ref: ForwardedRef<ReportA
const [disabledActions, setDisabledActions] = useState<ContextMenuAction[]>([]);

const contentRef = useRef<View>(null);
const anchorRef = useRef<View | HTMLDivElement>(null);
const anchorRef = useRef<View | HTMLDivElement | null>(null);
const dimensionsEventListener = useRef<EmitterSubscription | null>(null);
const contextMenuAnchorRef = useRef<ContextMenuAnchor | null>(null);
const contextMenuTargetNode = useRef<HTMLElement | null>(null);
Expand Down Expand Up @@ -163,11 +163,16 @@ function PopoverReportActionContextMenu(_props: never, ref: ForwardedRef<ReportA
isPinnedChat = false,
isUnreadChat = false,
disabledOptions = [],
shouldCloseOnTarget = false,
) => {
const {pageX = 0, pageY = 0} = extractPointerEvent(event);
contextMenuAnchorRef.current = contextMenuAnchor;
contextMenuTargetNode.current = event.target as HTMLElement;

if (shouldCloseOnTarget) {
anchorRef.current = event.target as HTMLDivElement;
} else {
anchorRef.current = null;
}
setInstanceID(Math.random().toString(36).substr(2, 5));

onPopoverShow.current = onShow;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type ShowContextMenu = (
isPinnedChat?: boolean,
isUnreadChat?: boolean,
disabledOptions?: ContextMenuAction[],
shouldCloseOnTarget?: boolean,
) => void;

type ReportActionContextMenu = {
Expand Down Expand Up @@ -113,6 +114,7 @@ function showContextMenu(
isPinnedChat = false,
isUnreadChat = false,
disabledActions: ContextMenuAction[] = [],
shouldCloseOnTarget = false,
) {
if (!contextMenuRef.current) {
return;
Expand Down Expand Up @@ -140,6 +142,7 @@ function showContextMenu(
isPinnedChat,
isUnreadChat,
disabledActions,
shouldCloseOnTarget,
);
}

Expand Down