Skip to content

Commit 4ed9f3c

Browse files
committed
fix(#2163): restart closing animation when container height get updated
1 parent 2898ada commit 4ed9f3c

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/components/bottomSheet/BottomSheet.tsx

+19
Original file line numberDiff line numberDiff line change
@@ -1534,6 +1534,25 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
15341534
}
15351535

15361536
animatedContainerHeightDidChange.value = result !== previous;
1537+
1538+
/**
1539+
* When user close the bottom sheet while the keyboard open on Android with
1540+
* software keyboard layout mode set to resize, the close position would be
1541+
* set to the container height - the keyboard height, and when the keyboard
1542+
* closes, the container height and here we restart the animation again.
1543+
*
1544+
* [read more](https://github.com/gorhom/react-native-bottom-sheet/issues/2163)
1545+
*/
1546+
if (
1547+
animatedAnimationState.value === ANIMATION_STATE.RUNNING &&
1548+
animatedAnimationSource.value === ANIMATION_SOURCE.GESTURE &&
1549+
animatedNextPositionIndex.value === -1
1550+
) {
1551+
animateToPosition(
1552+
animatedClosedPosition.value,
1553+
ANIMATION_SOURCE.GESTURE
1554+
);
1555+
}
15371556
}
15381557
);
15391558

0 commit comments

Comments
 (0)