Skip to content

Commit 43dc9b0

Browse files
committed
Reload table view cells after move
1 parent 8a6ad61 commit 43dc9b0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Firestore/FirebaseFirestoreUI/FUIFirestoreTableViewDataSource.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,16 @@ - (void)batchedArray:(FUIBatchedArray *)array
130130
withRowAnimation:self.animation];
131131

132132
[self.tableView endUpdates];
133+
134+
// Reload paths that have been moved.
135+
NSMutableArray *movedIndexPaths =
136+
[NSMutableArray arrayWithCapacity:diff.movedResultIndexes.count];
137+
for (NSNumber *movedResultIndex in diff.movedResultIndexes) {
138+
NSIndexPath *moved = [NSIndexPath indexPathForItem:movedResultIndex.integerValue inSection:0];
139+
[movedIndexPaths addObject:moved];
140+
}
141+
[self.tableView reloadRowsAtIndexPaths:movedIndexPaths
142+
withRowAnimation:UITableViewRowAnimationAutomatic];
133143
}
134144

135145
- (void)batchedArray:(FUIBatchedArray *)array queryDidFailWithError:(NSError *)error {

0 commit comments

Comments
 (0)