Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add dismiss space for emoji picker when searching #53806

Merged
merged 3 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type {FlashList} from '@shopify/flash-list';
import {useCallback, useEffect, useMemo, useRef, useState} from 'react';
import emojis from '@assets/emojis';
import {useFrequentlyUsedEmojis} from '@components/OnyxProvider';
import useKeyboardState from '@hooks/useKeyboardState';
import useLocalize from '@hooks/useLocalize';
import usePreferredEmojiSkinTone from '@hooks/usePreferredEmojiSkinTone';
import useStyleUtils from '@hooks/useStyleUtils';
Expand All @@ -23,12 +24,14 @@ const useEmojiPickerMenu = () => {
const [preferredSkinTone] = usePreferredEmojiSkinTone();
const {windowHeight} = useWindowDimensions();
const StyleUtils = useStyleUtils();
const {keyboardHeight} = useKeyboardState();

/**
* At EmojiPicker has set innerContainerStyle with maxHeight: '95%' by styles.popoverInnerContainer
* to avoid the list style to be cut off due to the list height being larger than the container height
* so we need to calculate listStyle based on the height of the window and innerContainerStyle at the EmojiPicker
*/
const listStyle = StyleUtils.getEmojiPickerListHeight(isListFiltered, windowHeight * 0.95);
const listStyle = StyleUtils.getEmojiPickerListHeight(isListFiltered, windowHeight * 0.95 - keyboardHeight);
huult marked this conversation as resolved.
Show resolved Hide resolved

useEffect(() => {
setFilteredEmojis(allEmojis);
Expand Down
1 change: 1 addition & 0 deletions src/styles/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,7 @@ function getEmojiPickerListHeight(isRenderingShortcutRow: boolean, windowHeight:
return {
...style,
maxHeight: windowHeight - dimensions,
height: Math.min(style.height, windowHeight - dimensions),
huult marked this conversation as resolved.
Show resolved Hide resolved
};
}
return style;
Expand Down
Loading