Skip to content

Commit

Permalink
update implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
FitseTLT committed Feb 27, 2025
1 parent 789797b commit e059a6c
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React, {forwardRef, useCallback, useEffect, useImperativeHandle, useRef,

/* eslint-disable no-restricted-imports */
import type {EmitterSubscription, GestureResponderEvent, NativeTouchEvent, View} from 'react-native';
import {DeviceEventEmitter, Dimensions, InteractionManager} from 'react-native';
import {DeviceEventEmitter, Dimensions} from 'react-native';
import type {OnyxEntry} from 'react-native-onyx';
import ConfirmModal from '@components/ConfirmModal';
import PopoverWithMeasuredContent from '@components/PopoverWithMeasuredContent';
Expand All @@ -13,6 +13,7 @@ import calculateAnchorPosition from '@libs/calculateAnchorPosition';
import * as ReportActionsUtils from '@libs/ReportActionsUtils';

Check failure on line 13 in src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Namespace imports from @libs are not allowed. Use named imports instead. Example: import { method } from "@libs/module"
import * as IOU from '@userActions/IOU';

Check failure on line 14 in src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Namespace imports from @userActions are not allowed. Use named imports instead. Example: import { action } from "@userActions/module"
import * as Report from '@userActions/Report';

Check failure on line 15 in src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Namespace imports from @userActions are not allowed. Use named imports instead. Example: import { action } from "@userActions/module"
import CONST from '@src/CONST';
import type {AnchorDimensions} from '@src/styles';
import type {ReportAction} from '@src/types/onyx';
import BaseReportActionContextMenu from './BaseReportActionContextMenu';
Expand Down Expand Up @@ -77,7 +78,7 @@ function PopoverReportActionContextMenu(_props: unknown, ref: ForwardedRef<Repor
});

const onPopoverShow = useRef(() => {});
const isContextMenuOpeningRef = useRef(false);
const [isContextMenuOpening, setIsContextMenuOpening] = useState(false);
const onPopoverHide = useRef(() => {});
const onEmojiPickerToggle = useRef<undefined | ((state: boolean) => void)>();
const onCancelDeleteModal = useRef(() => {});
Expand Down Expand Up @@ -176,7 +177,7 @@ function PopoverReportActionContextMenu(_props: unknown, ref: ForwardedRef<Repor
isOverflowMenu = false,
isThreadReportParentActionParam = false,
) => {
isContextMenuOpeningRef.current = true;
setIsContextMenuOpening(true);
const {pageX = 0, pageY = 0} = extractPointerEvent(event);
contextMenuAnchorRef.current = contextMenuAnchor;
contextMenuTargetNode.current = event.target as HTMLDivElement;
Expand Down Expand Up @@ -243,10 +244,10 @@ function PopoverReportActionContextMenu(_props: unknown, ref: ForwardedRef<Repor
return;
}

// After the animation of the popover opening ends, reset isContextMenuOpeningRef.
InteractionManager.runAfterInteractions(() => {
isContextMenuOpeningRef.current = false;
});
// After the context menu opening animation ends reset isContextMenuOpening.
setTimeout(() => {
setIsContextMenuOpening(false);
}, CONST.ANIMATED_TRANSITION);
}, [isPopoverVisible]);

/** Run the callback and return a noop function to reset it */
Expand Down Expand Up @@ -330,7 +331,7 @@ function PopoverReportActionContextMenu(_props: unknown, ref: ForwardedRef<Repor
runAndResetOnPopoverHide,
clearActiveReportAction,
contentRef,
isContextMenuOpening: isContextMenuOpeningRef.current,
isContextMenuOpening,
}));

const reportAction = reportActionRef.current;
Expand Down

0 comments on commit e059a6c

Please sign in to comment.