Skip to content

Commit 93d5189

Browse files
committed
fix(ios): reordering fix
1 parent 21d5a02 commit 93d5189

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

src/collectionview/index.ios.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1426,10 +1426,10 @@ class UICollectionViewDelegateImpl extends UICollectionViewCacheDelegateFlowLayo
14261426
owner.scrollViewDidEndScrollingAnimation(scrollView);
14271427
}
14281428
}
1429-
collectionViewTargetIndexPathForMoveFromItemAtIndexPathToProposedIndexPath(collectionView: UICollectionView, currentIndexPath: NSIndexPath, proposedIndexPath: NSIndexPath): NSIndexPath {
1430-
if (currentIndexPath === proposedIndexPath) {
1431-
return proposedIndexPath;
1432-
}
1429+
collectionViewTargetIndexPathForMoveFromItemAtIndexPathToProposedIndexPath(collectionView: UICollectionView, currentIndexPath: NSIndexPath, proposedIndexPath: NSIndexPath): NSIndexPath {
1430+
if (currentIndexPath === proposedIndexPath) {
1431+
return proposedIndexPath;
1432+
}
14331433
const owner = this._owner?.get();
14341434
if (owner && !owner._canReorderToPosition(currentIndexPath.row, proposedIndexPath.row, owner.getItemAtIndex(proposedIndexPath.row))) {
14351435
return currentIndexPath;
@@ -1501,6 +1501,19 @@ class UICollectionViewDelegateFixedSizeImpl extends NSObject implements UICollec
15011501
owner.scrollViewDidEndScrollingAnimation(scrollView);
15021502
}
15031503
}
1504+
collectionViewTargetIndexPathForMoveFromItemAtIndexPathToProposedIndexPath(collectionView: UICollectionView, currentIndexPath: NSIndexPath, proposedIndexPath: NSIndexPath): NSIndexPath {
1505+
if (currentIndexPath === proposedIndexPath) {
1506+
return proposedIndexPath;
1507+
}
1508+
const owner = this._owner?.get();
1509+
if (owner && !owner._canReorderToPosition(currentIndexPath.row, proposedIndexPath.row, owner.getItemAtIndex(proposedIndexPath.row))) {
1510+
return currentIndexPath;
1511+
}
1512+
owner._reorderItemInSource(currentIndexPath.row, proposedIndexPath.row, false);
1513+
owner.clearCachedSize(currentIndexPath.row, proposedIndexPath.row);
1514+
1515+
return proposedIndexPath;
1516+
}
15041517
}
15051518

15061519
@NativeClass

0 commit comments

Comments
 (0)