Skip to content

Component & Props

This page summarises the role of VirtualViewList, its configuration options, and how it collaborates with helper managers and demos.

Overview

  • Use case: high-volume scrollable lists in games or apps.
  • Key techniques: node pooling, viewport culling, batched refresh.
  • Main script: assets/Script/Core/VirtualList/VirtualViewList.ts
  • Managers:
    • VirtualListDataManager: data source, size cache, offset lookup.
    • VirtualListNodeManager: templates, pooling, animations.
    • VirtualListPerformanceManager: frame monitoring, adaptive caching.

Highlights

  • Node reuse keeps memory low even with thousands of items.
  • Viewport-driven rendering reduces draw calls.
  • Supports vertical, horizontal, grid and reverse directions.
  • Frame-splitting avoids long stalls when loading huge datasets.
  • Dynamic operations: insert, delete, update, resize items at runtime.
  • Nested scroll friendly; optional VirtualCullingViewport for advanced culling.

Environment

  • Engine: Cocos Creator 3.x / 2.x
  • Language: TypeScript
  • Targets: Web, mini games, Android, iOS

Platform Matrix

Cocos CreatorMini GamesHTML5AndroidiOS
3.x
2.x

Key Properties

PropertyValuesDescription
scrollViewScrollViewHost scroll view component.
layoutTypeVERTICAL / HORIZONTAL / GRIDList layout mode.
scrollDirectionVERTICAL / HORIZONTALMain axis for grid layout.
verticalRenderDirectionTOP_TO_BOTTOM / BOTTOM_TO_TOPVertical rendering order.
horizontalRenderDirectionLEFT_TO_RIGHT / RIGHT_TO_LEFTHorizontal rendering order.
itemSpacingnumber (default 10)Spacing in list mode.
cols / rowsnumber (default 2)Grid columns or rows.
girdVertRowsSpacingnumber (default 10)Grid row spacing (vertical).
girdVertColsSpacingnumber (default 10)Grid column spacing (vertical).
girdHoriRowsSpacingnumber (default 10)Grid row spacing (horizontal).
girdHoriColsSpacingnumber (default 10)Grid column spacing (horizontal).
paddingTop / paddingBottomnumberVertical padding.
paddingLeft / paddingRightnumberHorizontal padding.
enableNestedSupportbooleanEnable nested scroll handling.
autoOptimizePerformancebooleanAuto adjust cache & batch size.
cacheRationumber (default 0.1)Preload buffer multiplier.

Frequently Used APIs

  • ReloadData(typeArray, customSize?)
  • InsertItemAt(index, type, animate?, size?)
  • RemoveItemAt(index, animate?)
  • RegisterTemplate(type, nodeOrGetter, isDefault?)
  • ScrollToIndex(index, duration?, callback?)
  • UpdateItemAt(index, type?)
  • UpdateItemSize(index, newSize)
  • PreloadItems(count?)
  • Refresh()

Callbacks

CallbackTriggerUsage
onItemInitNode first createdInitial binding, cache refs.
onItemUpdateNode becomes visible againRefresh visuals with latest data.
onScrollingDuring scrollUpdate progress bars, sticky headers etc.
onLoadFinishedInitial load / refresh completedHide loaders, start follow-up logic.

Release Notes

VersionDateHighlights
3.2.12025-10-14Demo suite refreshed, polish tweaks.
3.2.02025-09-29Chat text measurement optimised; adaptive demos.
3.1.02025-09-23New chat & backpack demos; InsertItemAt size parameter; refactored demos.
3.0.02025-09-09Reverse rendering support, ranking/chat/card demos added.
1.0.02025-03-06Initial release with virtual list, pooling, frame-splitting.