feat: add preloadItemCount for List, incase we need preload more items before scroll to end
This commit is contained in:
		| @@ -68,7 +68,7 @@ class ListAdapter extends RecyclerView.Adapter<ListAdapter.DoricViewHolder> { | ||||
|                 holder.listItemNode.blend(jsObject.getProperty("props").asObject()); | ||||
|             } | ||||
|             if (this.loadMore | ||||
|                     && position >= this.itemCount | ||||
|                     && position >= this.itemCount - this.listNode.preloadItemCount | ||||
|                     && !TextUtils.isEmpty(this.listNode.onLoadMoreFuncId)) { | ||||
|                 callLoadMore(); | ||||
|             } | ||||
|   | ||||
| @@ -76,6 +76,8 @@ public class ListNode extends SuperNode<RecyclerView> implements IDoricScrollabl | ||||
|     private String onScrollEndFuncId; | ||||
|     private final DoricJSDispatcher jsDispatcher = new DoricJSDispatcher(); | ||||
|  | ||||
|     int preloadItemCount = 0; | ||||
|  | ||||
|     public ListNode(DoricContext doricContext) { | ||||
|         super(doricContext); | ||||
|         this.listAdapter = new ListAdapter(this); | ||||
| @@ -377,6 +379,12 @@ public class ListNode extends SuperNode<RecyclerView> implements IDoricScrollabl | ||||
|                 } | ||||
|                 this.onDraggedFuncId = prop.asString().value(); | ||||
|                 break; | ||||
|             case "preloadItemCount": | ||||
|                 if (!prop.isNumber()) { | ||||
|                     return; | ||||
|                 } | ||||
|                 this.preloadItemCount = prop.asNumber().toInt(); | ||||
|                 break; | ||||
|             default: | ||||
|                 super.blend(view, name, prop); | ||||
|                 break; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user