diff --git a/src/index.tsx b/src/index.tsx index a245deb..df96af4 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -290,6 +290,7 @@ export class ScrollBottomSheet extends Component> { private didScrollUpAndPullDown: Animated.Node; private setTranslationY: Animated.Node; private extraOffset: Animated.Node; + private currentHeight: number private calculateNextSnapPoint: ( i?: number ) => number | Animated.Node; @@ -335,6 +336,7 @@ export class ScrollBottomSheet extends Component> { const drawerOldGestureState = new Value(-1); const lastSnapInRange = new Value(1); + this.currentHeight = 0 this.prevTranslateYOffset = new Value(initialSnap); this.translationY = new Value(initialSnap); @@ -667,6 +669,14 @@ export class ScrollBottomSheet extends Component> { } }; + + private onContentSizeChange = (_, height: number) => { + if (this.currentHeight > height) { + this.lastStartScrollY.setValue(0); + } + this.currentHeight = height; + }; + snapTo = (index: number) => { const snapPoints = this.getNormalisedSnapPoints(); this.isManuallySetValue.setValue(1); @@ -730,6 +740,7 @@ export class ScrollBottomSheet extends Component> { // @ts-ignore decelerationRate={this.decelerationRate} onScrollBeginDrag={this.onScrollBeginDrag} + onContentSizeChange={this.onContentSizeChange} scrollEventThrottle={1} contentContainerStyle={[ rest.contentContainerStyle,