feat:add clearNode when reset listview's renderItem

This commit is contained in:
pengfei.zhou 2019-11-15 09:57:59 +08:00
parent 8d582e3371
commit bdabde2f56
3 changed files with 6 additions and 1 deletions

View File

@ -78,6 +78,10 @@ public abstract class SuperNode<V extends View> extends ViewNode<V> {
subNodes.put(id, model); subNodes.put(id, model);
} }
public void clearSubModel() {
subNodes.clear();
}
protected abstract void blendSubNode(JSObject subProperties); protected abstract void blendSubNode(JSObject subProperties);
protected void blendSubLayoutConfig(ViewNode viewNode, JSObject jsObject) { protected void blendSubLayoutConfig(ViewNode viewNode, JSObject jsObject) {

View File

@ -45,7 +45,7 @@ public class ListAdapter extends RecyclerView.Adapter<ListAdapter.DoricViewHolde
int batchCount = 15; int batchCount = 15;
SparseArray<String> itemValues = new SparseArray<>(); SparseArray<String> itemValues = new SparseArray<>();
public ListAdapter(ListNode listNode) { ListAdapter(ListNode listNode) {
this.listNode = listNode; this.listNode = listNode;
} }

View File

@ -76,6 +76,7 @@ public class ListNode extends SuperNode<RecyclerView> {
this.listAdapter.renderItemFuncId = prop.asString().value(); this.listAdapter.renderItemFuncId = prop.asString().value();
// If reset renderItem,should reset native cache. // If reset renderItem,should reset native cache.
this.listAdapter.itemValues.clear(); this.listAdapter.itemValues.clear();
clearSubModel();
break; break;
case "batchCount": case "batchCount":
this.listAdapter.batchCount = 15; this.listAdapter.batchCount = 15;