Skip to content

VirtualViewList API

Reference for the main component API.

Properties

GroupMemberDefaultDescription
LayoutlayoutTypeVERTICALOverall layout mode.
LayoutscrollDirectionVERTICALGrid main axis direction.
DirectionverticalRenderDirectionTOP_TO_BOTTOMVertical render order.
DirectionhorizontalRenderDirectionLEFT_TO_RIGHTHorizontal render order.
SpacingitemSpacing10List spacing.
Gridcols2Columns when scrolling vertically.
Gridrows2Rows when scrolling horizontally.
GridgirdVertRowsSpacing10Vertical grid row gap.
GridgirdVertColsSpacing10Vertical grid column gap.
GridgirdHoriRowsSpacing10Horizontal grid row gap.
GridgirdHoriColsSpacing10Horizontal grid column gap.
PaddingpaddingTop / paddingBottom0Vertical padding.
PaddingpaddingLeft / paddingRight0Horizontal padding.
AdvancedenableNestedSupportfalseEnable nested scroll handling.
AdvancedautoOptimizePerformancetrueAdaptive performance toggles.
AdvancedcacheRatio0.1Preload buffer multiplier.

Templates & Callbacks

MethodDescription
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

CallbackDescription
onItemInit?: (node, index) => voidFired when node is created for the first time
onItemUpdate?: (node, index) => voidFired when node re-enters viewport
onScrolling?: (scrollRatio) => voidFired during scroll, returns 0~1 ratio
onLoadFinished?: () => voidFired after initial load or refresh completes
onPullDownRefresh?: () => voidFired when pull-down exceeds 50px threshold with >1s interval
onPullUpLoad?: () => voidFired when pull-up exceeds 50px threshold with >1s interval

Data Manipulation

MethodDescription
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

MethodDescription
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

MethodDescription
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.

Last updated: