Skip to content

Commit 481958e

Browse files
committed
Fix android bug when swipe fast
1 parent db7a400 commit 481958e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/DraggablePanel.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,17 @@ export const DraggablePanel = React.forwardRef((props: Props, ref) => {
9696

9797
const onScroll = (event: NativeSyntheticEvent<NativeScrollEvent>) => {
9898
if (!animating) {
99-
const y = event.nativeEvent.contentOffset.y;
99+
const {y} = event.nativeEvent.contentOffset;
100100
if (
101101
!props.expandable &&
102102
y < SCREEN_HEIGHT - (SCREEN_HEIGHT * height) / DEFAULT_PANEL_HEIGHT
103103
) {
104104
return;
105105
}
106106
animatedValue.setValue(1 - Math.floor(y) / Math.floor(SCREEN_HEIGHT));
107-
if (Math.floor(y) === Math.floor(SCREEN_HEIGHT)) {
107+
// >= Fix the android issue, cause for some reason it goes for more than SCREEN_HEIGHT
108+
// if the use swipes faster
109+
if (Math.floor(y) >= Math.floor(SCREEN_HEIGHT)) {
108110
togglePopupVisibility(false);
109111
setAnimating(false);
110112
props.onDismiss && props.onDismiss();

0 commit comments

Comments
 (0)