From c5b15457c059b4e63e87983654524a87d81e4134 Mon Sep 17 00:00:00 2001 From: Chris Trinh Date: Wed, 10 Jan 2018 20:26:45 -0800 Subject: [PATCH] Fixes bug causing gaps to occur when dragging beyond the end of the list and back --- index.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 16ce461..e46cd3c 100644 --- a/index.js +++ b/index.js @@ -301,8 +301,15 @@ class SortableListView extends React.Component { } handleContentSizeChange = (width, height) => { - this.scrollContainerHeight = height - } + this.scrollContainerHeight = height; + + // NOTE: Need to recalcuate the scrollView height when items are drag-and-hold beyond the + // length of the list and back into it. Without this checkTargetElement uses the old + // cache verison the height of the scrollView creating a gap. + if (this.scrollValue > 0) { + this.scrollTo({ y: height, animated: !this.props.disableAnimatedScrolling }); + } + }; scrollAnimation = () => { if (this.state.active) {