@@ -2,6 +2,7 @@ import type {FlashList} from '@shopify/flash-list';
2
2
import { useCallback , useEffect , useMemo , useRef , useState } from 'react' ;
3
3
import emojis from '@assets/emojis' ;
4
4
import { useFrequentlyUsedEmojis } from '@components/OnyxProvider' ;
5
+ import useKeyboardState from '@hooks/useKeyboardState' ;
5
6
import useLocalize from '@hooks/useLocalize' ;
6
7
import usePreferredEmojiSkinTone from '@hooks/usePreferredEmojiSkinTone' ;
7
8
import useStyleUtils from '@hooks/useStyleUtils' ;
@@ -23,12 +24,15 @@ const useEmojiPickerMenu = () => {
23
24
const [ preferredSkinTone ] = usePreferredEmojiSkinTone ( ) ;
24
25
const { windowHeight} = useWindowDimensions ( ) ;
25
26
const StyleUtils = useStyleUtils ( ) ;
27
+ const { keyboardHeight} = useKeyboardState ( ) ;
28
+
26
29
/**
27
- * At EmojiPicker has set innerContainerStyle with maxHeight: '95%' by styles.popoverInnerContainer
28
- * to avoid the list style to be cut off due to the list height being larger than the container height
29
- * so we need to calculate listStyle based on the height of the window and innerContainerStyle at the EmojiPicker
30
+ * The EmojiPicker sets the `innerContainerStyle` with `maxHeight: '95%'` in `styles.popoverInnerContainer`
31
+ * to prevent the list from being cut off when the list height exceeds the container's height.
32
+ * To calculate the available list height, we subtract the keyboard height from the `windowHeight`
33
+ * to ensure the list is properly adjusted when the keyboard is visible.
30
34
*/
31
- const listStyle = StyleUtils . getEmojiPickerListHeight ( isListFiltered , windowHeight * 0.95 ) ;
35
+ const listStyle = StyleUtils . getEmojiPickerListHeight ( isListFiltered , windowHeight * 0.95 - keyboardHeight ) ;
32
36
33
37
useEffect ( ( ) => {
34
38
setFilteredEmojis ( allEmojis ) ;
0 commit comments