Skip to content

Commit

Permalink
fix: ios rollback breaking change
Browse files Browse the repository at this point in the history
  • Loading branch information
farfromrefug committed Dec 2, 2020
1 parent 6e980c1 commit a301f0f
Showing 1 changed file with 41 additions and 41 deletions.
82 changes: 41 additions & 41 deletions src/collectionview.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,11 @@ export class CollectionView extends CollectionViewBase {
if (Trace.isEnabled()) {
CLog(CLogTypes.info, 'deleteItemsAtIndexPaths', indexes.count);
}
dispatch_async(main_queue, () => {
view.performBatchUpdatesCompletion(() => {
view.deleteItemsAtIndexPaths(indexes);
}, null);
});
// dispatch_async(main_queue, () => {
view.performBatchUpdatesCompletion(() => {
view.deleteItemsAtIndexPaths(indexes);
}, null);
// });
return;
}
case ChangeType.Update: {
Expand All @@ -262,13 +262,13 @@ export class CollectionView extends CollectionViewBase {
if (Trace.isEnabled()) {
CLog(CLogTypes.info, 'reloadItemsAtIndexPaths',event.index, indexes.count);
}
dispatch_async(main_queue, () => {
UIView.performWithoutAnimation(()=>{
view.performBatchUpdatesCompletion(() => {
view.reloadItemsAtIndexPaths(indexes);
}, null);
});
// dispatch_async(main_queue, () => {
UIView.performWithoutAnimation(()=>{
view.performBatchUpdatesCompletion(() => {
view.reloadItemsAtIndexPaths(indexes);
}, null);
});
// });

return;
}
Expand All @@ -280,39 +280,39 @@ export class CollectionView extends CollectionViewBase {
if (Trace.isEnabled()) {
CLog(CLogTypes.info, 'insertItemsAtIndexPaths', indexes.count);
}
dispatch_async(main_queue, () => {
view.performBatchUpdatesCompletion(() => {
view.insertItemsAtIndexPaths(indexes);
}, null);
});
// dispatch_async(main_queue, () => {
view.performBatchUpdatesCompletion(() => {
view.insertItemsAtIndexPaths(indexes);
}, null);
// });
// Reload the items to avoid duplicate Load on Demand indicators:
return;
}
case ChangeType.Splice: {
dispatch_async(main_queue, () => {
view.performBatchUpdatesCompletion(() => {
if (event.addedCount > 0) {
const indexes = NSMutableArray.alloc<NSIndexPath>().init();
for (let index = 0; index < event.addedCount; index++) {
indexes.addObject(NSIndexPath.indexPathForItemInSection(event.index + index, 0));
}
view.insertItemsAtIndexPaths(indexes);
// dispatch_async(main_queue, () => {
view.performBatchUpdatesCompletion(() => {
if (event.addedCount > 0) {
const indexes = NSMutableArray.alloc<NSIndexPath>().init();
for (let index = 0; index < event.addedCount; index++) {
indexes.addObject(NSIndexPath.indexPathForItemInSection(event.index + index, 0));
}
if (event.removed && event.removed.length > 0) {
const indexes = NSMutableArray.new<NSIndexPath>();
for (let index = 0; index < event.removed.length; index++) {
indexes.addObject(NSIndexPath.indexPathForItemInSection(event.index + index, 0));
}
this.unbindUnusedCells(event.removed);
if (Trace.isEnabled()) {
CLog(CLogTypes.info, 'deleteItemsAtIndexPaths', indexes.count);
}
view.performBatchUpdatesCompletion(() => {
view.deleteItemsAtIndexPaths(indexes);
}, null);
view.insertItemsAtIndexPaths(indexes);
}
if (event.removed && event.removed.length > 0) {
const indexes = NSMutableArray.new<NSIndexPath>();
for (let index = 0; index < event.removed.length; index++) {
indexes.addObject(NSIndexPath.indexPathForItemInSection(event.index + index, 0));
}
}, null);
});
this.unbindUnusedCells(event.removed);
if (Trace.isEnabled()) {
CLog(CLogTypes.info, 'deleteItemsAtIndexPaths', indexes.count);
}
view.performBatchUpdatesCompletion(() => {
view.deleteItemsAtIndexPaths(indexes);
}, null);
}
}, null);
// });
return;
}
}
Expand Down Expand Up @@ -362,9 +362,9 @@ export class CollectionView extends CollectionViewBase {

// TODO: this is ugly look here: https://github.com/nativescript-vue/nativescript-vue/issues/525
// this.clearRealizedCells();
dispatch_async(main_queue, () => {
this.nativeViewProtected.reloadData();
});
// dispatch_async(main_queue, () => {
this.nativeViewProtected.reloadData();
// });

const args = {
eventName: CollectionViewBase.dataPopulatedEvent,
Expand Down

0 comments on commit a301f0f

Please sign in to comment.