Skip to content

Commit

Permalink
fix: prevent animated content height value from getting below zero
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhom committed Jun 1, 2021
1 parent 7cfe70d commit d9b417f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/components/bottomSheet/BottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,16 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
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 (
Expand Down

0 comments on commit d9b417f

Please sign in to comment.