From 1f8265cfd4be404e2af9732c9bf19cc19c868597 Mon Sep 17 00:00:00 2001 From: Cong Pham Date: Wed, 27 Mar 2024 01:56:15 +0700 Subject: [PATCH] cleanup function and update comment --- .../EmojiPicker/EmojiPickerMenu/useEmojiPickerMenu.js | 6 +++++- src/hooks/useViewportOffsetTop/index.ts | 6 +----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/EmojiPicker/EmojiPickerMenu/useEmojiPickerMenu.js b/src/components/EmojiPicker/EmojiPickerMenu/useEmojiPickerMenu.js index ba3001703c04..c6f9f601f4df 100644 --- a/src/components/EmojiPicker/EmojiPickerMenu/useEmojiPickerMenu.js +++ b/src/components/EmojiPicker/EmojiPickerMenu/useEmojiPickerMenu.js @@ -24,7 +24,11 @@ const useEmojiPickerMenu = () => { const [preferredSkinTone] = usePreferredEmojiSkinTone(); const {windowHeight} = useWindowDimensions(); const StyleUtils = useStyleUtils(); - // calculate the height of the emoji picker based popoverInnerContainer style has maxHeight is 95% + /** + * 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); useEffect(() => { diff --git a/src/hooks/useViewportOffsetTop/index.ts b/src/hooks/useViewportOffsetTop/index.ts index 55b0345d01ff..56fb19187c4f 100644 --- a/src/hooks/useViewportOffsetTop/index.ts +++ b/src/hooks/useViewportOffsetTop/index.ts @@ -33,11 +33,7 @@ export default function useViewportOffsetTop(shouldAdjustScrollView = false): nu } }; updateOffsetTop(); - const removeViewportResizeListener = addViewportResizeListener(updateOffsetTop); - - return () => { - removeViewportResizeListener(); - }; + return addViewportResizeListener(updateOffsetTop); }, [initialHeight, shouldAdjustScrollView]); useEffect(() => {