VList is a high-performance virtual list component built on top of Cocos Creator ScrollView.
It targets large datasets, variable item sizes, loop mode, and frame-by-frame creation scenarios.
This repository includes reusable component code and complete demo scenes for quick integration.
- Virtual list rendering (
SingleColumn,SingleRow, flow layouts, pagination) - Loop list support
- Frame-by-frame creation support
- Nested list demos
- Pull-to-refresh demos
- Variable-size item support via
setItemSizeProvider
- Cocos Creator:
3.8.6
Defined in assets/scripts/demo/Main.ts:
virtual_single(virtual list)virtual_cols_rows(multi-row/multi-column)virtual_page(pagination)virtual_loop(loop list)virtual_frame_by_frame(frame-by-frame creation)nested(nested lists)chat(chat list)pull_refresh(pull-to-refresh)align(alignment demo)
- Open the project with Cocos Creator
3.8.6. - Add
VListto a node with aScrollViewstructure. - Set
defaultItem. - Bind renderer/provider callbacks.
- Set
numItems.
Example:
this.vList.setItemRenderer(this, (index, item) => {
// render item UI
});
this.vList.setItemProvider(this, (index) => {
// optional: return item type name / prefab key
return "default";
});
this.vList.setItemSizeProvider(this, (index) => {
// optional: variable size
return { width: 200, height: 100 };
});
this.vList.numItems = 1000;assets/scripts/VList.ts is intentionally kept as a single file.
To keep it maintainable, functions are grouped by module separators (for example: virtual core, linear scroll paths, page behaviors, lifecycle hooks, public scroll APIs).
When making changes:
- Prefer editing inside the existing module block instead of adding logic in random locations.
- Keep behavior changes and refactor/reorder changes in separate commits.
- For virtual scroll fixes, run regression with
docs/TEST_MATRIX.md, especially:virtual_loopvirtual_frame_by_framevirtual_cols_rows
- If a bug appears only during drag/inertia, test both:
- immediate drag interaction
- post-release settle (
SCROLL_ENDED) behavior
See: docs/TEST_MATRIX.md
Coverage includes:
- All 9 demo scenes
- High-risk interactions (fast drag, bottom rebound,
scrollToIndex, add/remove data) - Frame-by-frame interruption and viewport backfill behavior
See: CHANGELOG.md
Highlights:
- Frame-mode viewport backfill improvements
- Safer cleanup logic for loop/non-loop modes
- Defensive virtual item initialization for fast-scroll edge cases
- Temporary blank area during elastic overscroll can be normal
ScrollViewbehavior. - After bounce-back/scroll-end, the list should recover with no persistent blank gap.
If this project helps you, a star is appreciated.
WeChat:
