refactor: remove unnecessary useMemo hook

This commit is contained in:
Antonella Sgarlatta
2021-04-26 18:06:14 -03:00
parent 5ddd6eaa60
commit 2cb08bc8c2

View File

@@ -341,16 +341,12 @@ export const BottomSheet: React.FC<Props> = ({
};
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[] = [];