From 8d582e337143ca22bb3665e6999f54b5409cf9c1 Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Fri, 15 Nov 2019 09:44:30 +0800 Subject: [PATCH] feat:ignore the dirty call once to avoid after renderBunched items call render again --- .../main/java/pub/doric/shader/list/ListNode.java | 2 -- js-framework/src/ui/listview.ts | 12 +++++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Android/doric/src/main/java/pub/doric/shader/list/ListNode.java b/Android/doric/src/main/java/pub/doric/shader/list/ListNode.java index 3c96b9ec..95da4a0d 100644 --- a/Android/doric/src/main/java/pub/doric/shader/list/ListNode.java +++ b/Android/doric/src/main/java/pub/doric/shader/list/ListNode.java @@ -80,8 +80,6 @@ public class ListNode extends SuperNode { case "batchCount": this.listAdapter.batchCount = 15; break; - case "subviews": - break; default: super.blend(view, name, prop); break; diff --git a/js-framework/src/ui/listview.ts b/js-framework/src/ui/listview.ts index 984a5458..b59091cd 100644 --- a/js-framework/src/ui/listview.ts +++ b/js-framework/src/ui/listview.ts @@ -43,7 +43,7 @@ export interface IList extends IView { export class List extends Superview implements IList { private cachedViews: Map = new Map - + private ignoreDirtyCallOnce = false allSubviews() { return this.cachedViews.values() } @@ -67,7 +67,17 @@ export class List extends Superview implements IList { return view } + isDirty() { + if (this.ignoreDirtyCallOnce) { + this.ignoreDirtyCallOnce = false + //Ignore the dirty call once. + return false + } + return super.isDirty() + } + private renderBunchedItems(start: number, length: number) { + this.ignoreDirtyCallOnce = true; return new Array(Math.min(length, this.itemCount - start)).fill(0).map((_, idx) => { const listItem = this.getItem(start + idx) return listItem.toModel()