From d9b417f703ceb69a959b0ce59600e53d75560d1e Mon Sep 17 00:00:00 2001 From: Mo Gorhom Date: Tue, 1 Jun 2021 23:12:00 +0100 Subject: [PATCH] fix: prevent animated content height value from getting below zero --- src/components/bottomSheet/BottomSheet.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/components/bottomSheet/BottomSheet.tsx b/src/components/bottomSheet/BottomSheet.tsx index 197876254..87b97ea9c 100644 --- a/src/components/bottomSheet/BottomSheet.tsx +++ b/src/components/bottomSheet/BottomSheet.tsx @@ -338,6 +338,16 @@ const BottomSheetComponent = forwardRef( const animatedContentHeight = useDerivedValue(() => { const contentHeight = animatedSheetHeight.value - animatedHandleHeight.value; + + /** + * before the container is measured, `contentHeight` value will be below zero, + * which will lead to freeze the scrollable on Android. + * + * @link (https://github.com/gorhom/react-native-bottom-sheet/issues/470) + */ + if (contentHeight <= 0) { + return 0; + } const keyboardHeightInContainer = getKeyboardHeightInContainer(); if (