-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
9 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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'; | ||
|
@@ -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
|
||
import * as IOU from '@userActions/IOU'; | ||
Check failure on line 14 in src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.tsx
|
||
import * as Report from '@userActions/Report'; | ||
Check failure on line 15 in src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.tsx
|
||
import CONST from '@src/CONST'; | ||
import type {AnchorDimensions} from '@src/styles'; | ||
import type {ReportAction} from '@src/types/onyx'; | ||
import BaseReportActionContextMenu from './BaseReportActionContextMenu'; | ||
|
@@ -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(() => {}); | ||
|
@@ -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; | ||
|
@@ -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 */ | ||
|
@@ -330,7 +331,7 @@ function PopoverReportActionContextMenu(_props: unknown, ref: ForwardedRef<Repor | |
runAndResetOnPopoverHide, | ||
clearActiveReportAction, | ||
contentRef, | ||
isContextMenuOpening: isContextMenuOpeningRef.current, | ||
isContextMenuOpening, | ||
})); | ||
|
||
const reportAction = reportActionRef.current; | ||
|