Skip to content

Commit

Permalink
don't wrap dropdown menu children in button press if condition is lon…
Browse files Browse the repository at this point in the history
…g press (#6412)
  • Loading branch information
maxbbb authored Jan 18, 2025
1 parent edeb2be commit 77f697b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/DropdownMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { ImageSourcePropType, ImageURISource } from 'react-native';
import type { SFSymbols5_0 } from 'sf-symbols-typescript';
import type { DropdownMenuContentProps } from '@radix-ui/react-dropdown-menu';
import { ButtonPressAnimation } from './animations';
import ConditionalWrap from 'conditional-wrap';

export const DropdownMenuRoot = DropdownMenuPrimitive.Root;
export const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
Expand Down Expand Up @@ -112,7 +113,12 @@ export function DropdownMenu<T extends string>({
return (
<DropdownMenuRoot>
<DropdownMenuTrigger action={triggerAction}>
<ButtonPressAnimation testID={testID}>{children}</ButtonPressAnimation>
<ConditionalWrap
condition={triggerAction === 'press'}
wrap={children => <ButtonPressAnimation testID={testID}>{children}</ButtonPressAnimation>}
>
{children}
</ConditionalWrap>
</DropdownMenuTrigger>
<DropdownMenuContent
loop={loop}
Expand Down

0 comments on commit 77f697b

Please sign in to comment.