react-native-sortable-listview
react-native-sortable-listview copied to clipboard
Gaps/wrong item being hidden when drag-and-hold beyond the end of list when scrolling
This might be related to what is seen in #73.
Steps to reproduce:
- Drags and holds the active item beyond the end of the list.
- This should activate the scroll animation. (bug will only appear when items force a scroll)
- Item is still held and moved back up to the viewable list.
- Gaps and/or "off-by-one" error with the wrong item being hidden.
Reason: When the item is drag at the end of the list, the scrollView height has been changed. The rows underneath now have one less item to account for the total height (it is set to 0.01). checkTargetElement is using the old cached height value causing the "gap" to occur.
solution: When scroll is activated and the content size has changed force a 'scrollTo' new height, so that checkTargetElement can used the new values.
handleContentSizeChange = (width, height) => {
this.scrollContainerHeight = height;
if (this.scrollValue > 0) {
this.scrollTo({ y: height, animated: !this.props.disableAnimatedScrolling });
}
};