File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -342,13 +342,20 @@ export class CollectionView extends CollectionViewBase {
342342 case UIGestureRecognizerState . Began : {
343343 let point = gesture . locationInView ( collectionView ) ;
344344 const selectedIndexPath = collectionView . indexPathForItemAtPoint ( point ) ;
345- const view = this . getViewForItemAtIndex ( selectedIndexPath . row ) ;
346- if ( view ) {
347- const size = view . nativeViewProtected . bounds . size ;
348- point = gesture . locationInView ( view . nativeViewProtected ) ;
349- this . draggingStartDelta = [ point . x - size . width / 2 , point . y - size . height / 2 ] ;
345+ if ( selectedIndexPath ) {
346+ const view = this . getViewForItemAtIndex ( selectedIndexPath . row ) ;
347+ if ( view ) {
348+ const size = view . nativeViewProtected . bounds . size ;
349+ point = gesture . locationInView ( view . nativeViewProtected ) ;
350+ this . draggingStartDelta = [ point . x - size . width / 2 , point . y - size . height / 2 ] ;
351+ }
352+ collectionView . beginInteractiveMovementForItemAtIndexPath ( selectedIndexPath ) ;
353+ } else {
354+ // disable and enable to cancel the current gesture
355+ gesture . enabled = false ;
356+ gesture . enabled = true ;
350357 }
351- collectionView . beginInteractiveMovementForItemAtIndexPath ( selectedIndexPath ) ;
358+
352359 break ;
353360 }
354361 case UIGestureRecognizerState . Changed : {
You can’t perform that action at this time.
0 commit comments