diff --git a/app/components/slide_up_panel/slide_up_panel.js b/app/components/slide_up_panel/slide_up_panel.js index 75e666f65..480af918e 100644 --- a/app/components/slide_up_panel/slide_up_panel.js +++ b/app/components/slide_up_panel/slide_up_panel.js @@ -177,42 +177,38 @@ export default class SlideUpPanel extends PureComponent { destSnapPoint = this.snapPoints[2]; } else if (isGoingDown) { destSnapPoint = this.snapPoints.find((s) => s >= endOffsetY); + if (!destSnapPoint) { + destSnapPoint = this.snapPoints[2]; + } } else { destSnapPoint = this.snapPoints.find((s) => s <= endOffsetY); + if (!destSnapPoint) { + destSnapPoint = this.snapPoints[0]; + } } - if (destSnapPoint) { - this.translateYOffset.extractOffset(); - this.translateYOffset.setValue(translationY); - this.translateYOffset.flattenOffset(); - this.dragY.setValue(0); + this.translateYOffset.extractOffset(); + this.translateYOffset.setValue(translationY); + this.translateYOffset.flattenOffset(); + this.dragY.setValue(0); - if (destSnapPoint === this.snapPoints[2]) { - this.closeWithAnimation(); - } else { - Animated.spring(this.translateYOffset, { - velocity: velocityY, - tension: 68, - friction: 12, - toValue: destSnapPoint, - useNativeDriver: true, - }).start(() => { - this.setState({lastSnap: destSnapPoint}); - - // When dragging down the panel when is fully open reset the scrollView to the top - if (isGoingDown && destSnapPoint !== this.snapPoints[0]) { - this.scrollToTop(); - } - }); - } + if (destSnapPoint === this.snapPoints[2]) { + this.closeWithAnimation(); } else { Animated.spring(this.translateYOffset, { velocity: velocityY, tension: 68, friction: 12, - toValue: lastSnap, + toValue: destSnapPoint, useNativeDriver: true, - }).start(); + }).start(() => { + this.setState({lastSnap: destSnapPoint}); + + // When dragging down the panel when is fully open reset the scrollView to the top + if (isGoingDown && destSnapPoint !== this.snapPoints[0]) { + this.scrollToTop(); + } + }); } } };