Skip to content

Commit 996bee4

Browse files
committed
fix(android): ignore recycled holders in eachChild calls
1 parent e308dda commit 996bee4

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/collectionview/index.android.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,17 @@ export class CollectionView extends CollectionViewBase {
280280
onMeasure: () => this.updateInnerSize()
281281
});
282282
this.spanSize = this._getSpanSize;
283+
284+
// const animator = new jp.wasabeef.recyclerview.animators.FadeInAnimator();
285+
// // animator.setInterpolator(new android.view.animation.OvershootInterpolator());
286+
// animator.setMoveDuration(200);
287+
// Change animations are enabled by default since support-v7-recyclerview v22.
288+
// Need to disable them when using animation indicator.
289+
// animator.setSupportsChangeAnimations(false);
290+
291+
// nativeView.setItemAnimator(animator);
292+
// (nativeView.getItemAnimator() ).setSupportsChangeAnimations(false);
293+
283294
this.refresh();
284295
}
285296
@profile
@@ -614,6 +625,9 @@ export class CollectionView extends CollectionViewBase {
614625
private enumerateViewHolders<T = any>(cb: (v: CollectionViewCellHolder) => T) {
615626
let result: T, v: CollectionViewCellHolder;
616627
for (let it = this._viewHolders.values(), cellItemView: CollectionViewCellHolder = null; (cellItemView = it.next().value); ) {
628+
if (cellItemView['position'] === undefined ) {
629+
continue;
630+
}
617631
result = cb(cellItemView);
618632
if (result) {
619633
return result;
@@ -1220,7 +1234,8 @@ export class CollectionView extends CollectionViewBase {
12201234
}
12211235

12221236
onViewRecycled(holder) {
1223-
holder['position'] = null;
1237+
delete this.bindedViewHolders[holder['position']];
1238+
holder['position'] = undefined;
12241239
}
12251240
}
12261241
interface CollectionViewCellHolder extends com.nativescript.collectionview.CollectionViewCellHolder {

0 commit comments

Comments
 (0)