pl-fe: Fix floating elements position

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak
2024-10-04 00:29:50 +02:00
parent 93e0311984
commit 3fdd22e900
7 changed files with 16 additions and 6 deletions

View File

@ -1,4 +1,4 @@
import { useFloating, shift, flip } from '@floating-ui/react';
import { useFloating, shift, flip, autoUpdate } from '@floating-ui/react';
import clsx from 'clsx';
import React, { KeyboardEvent, useState } from 'react';
import { defineMessages, useIntl } from 'react-intl';
@ -24,6 +24,7 @@ const EmojiPickerDropdownContainer: React.FC<IEmojiPickerDropdownContainer> = ({
const { x, y, strategy, refs, update } = useFloating<HTMLButtonElement>({
middleware: [flip(), shift()],
whileElementsMounted: autoUpdate,
});
useClickOutside(refs, () => {

View File

@ -1,4 +1,4 @@
import { useFloating, shift } from '@floating-ui/react';
import { useFloating, shift, autoUpdate } from '@floating-ui/react';
import React, { useState } from 'react';
import { createPortal } from 'react-dom';
import { FormattedMessage, defineMessages, useIntl } from 'react-intl';
@ -33,6 +33,7 @@ const EmojiPicker: React.FC<IEmojiPicker> = ({ emoji, emojiUrl, ...props }) => {
const { x, y, strategy, refs, update } = useFloating<HTMLButtonElement>({
middleware: [shift()],
whileElementsMounted: autoUpdate,
});
useClickOutside(refs, () => {