diff --git a/src/screens/Messages/components/MessagesList.tsx b/src/screens/Messages/components/MessagesList.tsx index 4864fd099a..6299e96d59 100644 --- a/src/screens/Messages/components/MessagesList.tsx +++ b/src/screens/Messages/components/MessagesList.tsx @@ -38,7 +38,6 @@ import {ChatEmptyPill} from '#/components/dms/ChatEmptyPill' import {MessageItem} from '#/components/dms/MessageItem' import {NewMessagesPill} from '#/components/dms/NewMessagesPill' import {Loader} from '#/components/Loader' -import {Portal} from '#/components/Portal' import {Text} from '#/components/Typography' import {MessageInputEmbed, useMessageEmbed} from './MessageInputEmbed' @@ -449,15 +448,12 @@ export function MessagesList({ {isWeb && ( - - - setEmojiPickerState(prev => ({...prev, isOpen: false})) - } - /> - + setEmojiPickerState(prev => ({...prev, isOpen: false}))} + /> )} {newMessagesPill.show && } diff --git a/src/view/com/composer/text-input/web/EmojiPicker.web.tsx b/src/view/com/composer/text-input/web/EmojiPicker.web.tsx index 1d5dad4861..9c036757ed 100644 --- a/src/view/com/composer/text-input/web/EmojiPicker.web.tsx +++ b/src/view/com/composer/text-input/web/EmojiPicker.web.tsx @@ -10,6 +10,7 @@ import {DismissableLayer} from '@radix-ui/react-dismissable-layer' import {textInputWebEmitter} from '#/view/com/composer/text-input/textInputWebEmitter' import {atoms as a} from '#/alf' +import {Portal} from '#/components/Portal' const HEIGHT_OFFSET = 40 const WIDTH_OFFSET = 100 @@ -47,9 +48,14 @@ interface IProps { * the target element. */ pinToTop?: boolean + /** + * If `true`, renders the picker in a portal at the document root. Useful if + * the positioning is getting wacky due to other wrapping elements. + */ + portal?: boolean } -export function EmojiPicker({state, close, pinToTop}: IProps) { +export function EmojiPicker({state, close, pinToTop, portal}: IProps) { const {height, width} = useWindowDimensions() const isShiftDown = React.useRef(false) @@ -124,7 +130,7 @@ export function EmojiPicker({state, close, pinToTop}: IProps) { close() } - return ( + const picker = ( ) + return portal ? {picker} : picker }