From 2cb08bc8c24817e35f024fdac8df42f0b3ed54db Mon Sep 17 00:00:00 2001 From: Antonella Sgarlatta Date: Mon, 26 Apr 2021 18:06:14 -0300 Subject: [PATCH] refactor: remove unnecessary useMemo hook --- src/components/BottomSheet.tsx | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/components/BottomSheet.tsx b/src/components/BottomSheet.tsx index d76bcd3c..49bbb427 100644 --- a/src/components/BottomSheet.tsx +++ b/src/components/BottomSheet.tsx @@ -341,16 +341,12 @@ export const BottomSheet: React.FC = ({ }; const contentHeight = titleHeight + listHeight; + const maxLimit = 0.85 * screenHeight; + let snapPoints = [1]; - const snapPoints = useMemo(() => { - const screenHeight = Dimensions.get('window').height; - const maxLimit = 0.85 * screenHeight; - - if (contentHeight === 0) { - return [1]; - } - return contentHeight < maxLimit ? [contentHeight] : [maxLimit]; - }, [contentHeight]); + if (contentHeight > 0) { + snapPoints = contentHeight < maxLimit ? [contentHeight] : [maxLimit]; + } const expandSection = (sectionKey: string) => { const animations: Animated.CompositeAnimation[] = [];