VirtualViewList API
Reference for the main component API.
Properties
| Group | Member | Default | Description |
|---|---|---|---|
| Layout | layoutType | VERTICAL | Overall layout mode. |
| Layout | scrollDirection | VERTICAL | Grid main axis direction. |
| Direction | verticalRenderDirection | TOP_TO_BOTTOM | Vertical render order. |
| Direction | horizontalRenderDirection | LEFT_TO_RIGHT | Horizontal render order. |
| Spacing | itemSpacing | 10 | List spacing. |
| Grid | cols | 2 | Columns when scrolling vertically. |
| Grid | rows | 2 | Rows when scrolling horizontally. |
| Grid | girdVertRowsSpacing | 10 | Vertical grid row gap. |
| Grid | girdVertColsSpacing | 10 | Vertical grid column gap. |
| Grid | girdHoriRowsSpacing | 10 | Horizontal grid row gap. |
| Grid | girdHoriColsSpacing | 10 | Horizontal grid column gap. |
| Padding | paddingTop / paddingBottom | 0 | Vertical padding. |
| Padding | paddingLeft / paddingRight | 0 | Horizontal padding. |
| Advanced | enableNestedSupport | false | Enable nested scroll handling. |
| Advanced | autoOptimizePerformance | true | Adaptive performance toggles. |
| Advanced | cacheRatio | 0.1 | Preload buffer multiplier. |
Templates & Callbacks
| Method | Description |
|---|---|
RegisterTemplate(type, nodeOrGetter, isDefault?) | Register a template for a type id. |
RegisterTemplates(templates, defaultType?) | Register multiple templates at once. |
ClearTemplates() | Remove all templates and pools. |
SetCallbacks(callbacks) | Configure init/update/scroll/load/pull-refresh callbacks. |
IVirtualListCallbacks Interface
| Callback | Description |
|---|---|
onItemInit?: (node, index) => void | Fired when node is created for the first time |
onItemUpdate?: (node, index) => void | Fired when node re-enters viewport |
onScrolling?: (scrollRatio) => void | Fired during scroll, returns 0~1 ratio |
onLoadFinished?: () => void | Fired after initial load or refresh completes |
onPullDownRefresh?: () => void | Fired when pull-down exceeds 50px threshold with >1s interval |
onPullUpLoad?: () => void | Fired when pull-up exceeds 50px threshold with >1s interval |
Data Manipulation
| Method | Description |
|---|---|
ReloadData(typeArray, customSize?) | Reload the list with new type ids and optional sizes. |
Clear() | Clear all data and destroy visible nodes. |
InsertItemAt(index, type, animate?, size?) | Insert at position with optional animation. |
RemoveItemAt(index, animate?) | Remove at position. |
UpdateItemAt(index, type?) | Refresh item content; optional type switch. |
UpdateItemSize(index, newSize) | Update list item size (non-grid). |
Refresh() | Recalculate layout after config changes. |
Scrolling
| Method | Description |
|---|---|
ScrollToIndex(index, duration?, callback?) | Scroll to index, optionally animated. |
ScrollToTop(duration?, callback?) | Shortcut to top. |
ScrollToBottom(duration?, callback?) | Shortcut to bottom. |
GetItemNode(index) | Return visible node if present. |
Performance & Debug
| Method | Description |
|---|---|
PreloadItems(count?) | Warm up node pool. |
EnableDebugMode(enabled?) | Toggle verbose logging. |
GetTotalItemCount() | Number of data entries. |
GetTotalItemNodeCount() | Number of instantiated nodes. |
GetStatus() | Return counts, performance flags and memory snapshot. |