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
8 changes: 4 additions & 4 deletions src/components/ThreeDotsMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ function ThreeDotsMenu({
shouldSelfPosition = false,
threeDotsMenuRef,
sentryLabel,
isContainerFocused = true,
}: ThreeDotsMenuProps) {
const [modal] = useOnyx(ONYXKEYS.MODAL, {canBeMissing: true});

Expand Down Expand Up @@ -100,13 +101,12 @@ function ThreeDotsMenu({
hidePopoverMenu,
onThreeDotsPress,
}));

useEffect(() => {
if (!isBehindModal || !isPopupMenuVisible) {
if ((!isBehindModal || !isPopupMenuVisible) && isContainerFocused) {
return;
}
hidePopoverMenu();
}, [hidePopoverMenu, isBehindModal, isPopupMenuVisible]);
}, [hidePopoverMenu, isBehindModal, isPopupMenuVisible, isContainerFocused]);

useLayoutEffect(() => {
if (!getMenuPosition || !isPopupMenuVisible) {
Expand Down Expand Up @@ -166,7 +166,7 @@ function ThreeDotsMenu({
<PopoverMenu
onClose={hidePopoverMenu}
onModalHide={() => setRestoreFocusType(undefined)}
isVisible={isPopupMenuVisible && !isBehindModal}
isVisible={isPopupMenuVisible && !isBehindModal && isContainerFocused}
anchorPosition={position ?? anchorPosition ?? {horizontal: 0, vertical: 0}}
anchorAlignment={anchorAlignment}
onItemSelected={(item) => {
Expand Down
3 changes: 3 additions & 0 deletions src/components/ThreeDotsMenu/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ type ThreeDotsMenuProps = WithSentryLabel & {

/** Ref to the menu */
threeDotsMenuRef?: React.RefObject<{hidePopoverMenu: () => void; isPopupMenuVisible: boolean} | null>;

/** Whether the menu is focused */
isContainerFocused?: boolean;
};

type ThreeDotsMenuWithOptionalAnchorProps =
Expand Down
3 changes: 3 additions & 0 deletions src/pages/workspace/WorkspacesListRow.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {useIsFocused} from '@react-navigation/native';
import {Str} from 'expensify-common';
import React, {useCallback, useEffect, useRef} from 'react';
import {View} from 'react-native';
Expand All @@ -7,7 +8,7 @@
import Avatar from '@components/Avatar';
import Badge from '@components/Badge';
import Icon from '@components/Icon';
import * as Expensicons from '@components/Icon/Expensicons';

Check warning on line 11 in src/pages/workspace/WorkspacesListRow.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

'@components/Icon/Expensicons' import is restricted from being used by a pattern. Direct imports from Icon/Expensicons are deprecated. Please use lazy loading hooks instead. Use `useMemoizedLazyExpensifyIcons` from @hooks/useLazyAsset. See docs/LAZY_ICONS_AND_ILLUSTRATIONS.md for details

Check warning on line 11 in src/pages/workspace/WorkspacesListRow.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

'@components/Icon/Expensicons' import is restricted from being used. Direct imports from @components/Icon/Expensicons are deprecated. Please use lazy loading hooks instead. Use `useMemoizedLazyExpensifyIcons` from @hooks/useLazyAsset. See docs/LAZY_ICONS_AND_ILLUSTRATIONS.md for details
import type {PopoverMenuItem} from '@components/PopoverMenu';
import Text from '@components/Text';
import TextWithTooltip from '@components/TextWithTooltip';
Expand Down Expand Up @@ -126,6 +127,7 @@
const {translate} = useLocalize();
const {shouldUseNarrowLayout} = useResponsiveLayout();
const theme = useTheme();
const isFocused = useIsFocused();
const isNarrow = layoutWidth === CONST.LAYOUT_WIDTH.NARROW;
const icons = useMemoizedLazyExpensifyIcons(['ArrowRight', 'Hourglass']);
const illustrations = useMemoizedLazyIllustrations(['Mailbox', 'ShieldYellow']);
Expand Down Expand Up @@ -208,6 +210,7 @@
<BrickRoadIndicatorIcon brickRoadIndicator={brickRoadIndicator} />
</View>
<ThreeDotsMenu
isContainerFocused={isFocused}
shouldSelfPosition
menuItems={menuItems}
anchorAlignment={{horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.RIGHT, vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.TOP}}
Expand Down
Loading