mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-05 15:00:30 +03:00
Fix ref issue causing the menu to remain open unless an option is selected
This commit is contained in:
parent
7b84264b26
commit
c4d0a7a820
1 changed files with 24 additions and 21 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
import { Box, Icon, IconButton, Icons, Line, Menu, MenuItem, PopOut, RectCords, Text } from 'folds';
|
import { Box, Icon, IconButton, Icons, Line, Menu, MenuItem, PopOut, RectCords, Text } from 'folds';
|
||||||
import React, { MouseEventHandler, useEffect } from 'react';
|
import React, { forwardRef, MouseEventHandler, useEffect } from 'react';
|
||||||
|
|
||||||
import FocusTrap from 'focus-trap-react';
|
import FocusTrap from 'focus-trap-react';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
@ -36,24 +36,27 @@ type BaseOptionProps = {
|
||||||
closeMenu: () => void;
|
closeMenu: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function MessageDropdownMenu({
|
export const MessageDropdownMenu = forwardRef<HTMLDivElement, BaseOptionProps>(
|
||||||
mEvent,
|
(
|
||||||
room,
|
{
|
||||||
mx,
|
mEvent,
|
||||||
relations,
|
room,
|
||||||
canSendReaction,
|
mx,
|
||||||
canEdit,
|
relations,
|
||||||
canDelete,
|
canSendReaction,
|
||||||
canPinEvent,
|
canEdit,
|
||||||
hideReadReceipts,
|
canDelete,
|
||||||
onReactionToggle,
|
canPinEvent,
|
||||||
onReplyClick,
|
hideReadReceipts,
|
||||||
onEditId,
|
onReactionToggle,
|
||||||
handleAddReactions,
|
onReplyClick,
|
||||||
closeMenu,
|
onEditId,
|
||||||
}: BaseOptionProps) {
|
handleAddReactions,
|
||||||
return (
|
closeMenu,
|
||||||
<Menu>
|
},
|
||||||
|
ref
|
||||||
|
) => (
|
||||||
|
<Menu ref={ref}>
|
||||||
{canSendReaction && (
|
{canSendReaction && (
|
||||||
<MessageQuickReactions
|
<MessageQuickReactions
|
||||||
onReaction={(key, shortcode) => {
|
onReaction={(key, shortcode) => {
|
||||||
|
|
@ -130,8 +133,8 @@ export function MessageDropdownMenu({
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Menu>
|
</Menu>
|
||||||
);
|
)
|
||||||
}
|
);
|
||||||
|
|
||||||
type ExtendedOptionsProps = BaseOptionProps & {
|
type ExtendedOptionsProps = BaseOptionProps & {
|
||||||
imagePackRooms: Room[] | undefined;
|
imagePackRooms: Room[] | undefined;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue