This is your go-to for controlling scroll views programmatically in WeChat's Skyline renderer. You get three API families: ScrollViewContext for triggering pull-to-refresh and scrolling to positions from the logic thread, DraggableSheetContext for controlling half-sheet panels, and worklet.scrollViewContext for direct scroll manipulation on the UI thread during gestures. The main gotcha is that ScrollViewContext only works when you enable the enhanced attribute on scroll-view, and the worklet version requires you to grab refs through a SharedValue rather than using node(). Good for auto-triggering refresh states, programmatically opening second-level drawers, or syncing scroll position with gesture animations. Requires baseline library 2.14.4 or higher depending on which APIs you need.

skills.sh installs
955
GitHub stars
56
last updated
Aug 21, 2026

Install

$ npx -y skills add wechat-miniprogram/skyline-skills --skill skyline-scroll-api --agent claude-code

Installs into .claude/skills of the current project.

Files

Skyline 滚动控制 API

适用场景

  • 程序化触发 scroll-view 下拉刷新或关闭刷新
  • 程序化触发/关闭下拉二级("二楼"页面)
  • 通过 ScrollViewContext 控制滚动位置和行为
  • 控制 DraggableSheet 半屏面板滚动到指定位置
  • 在 worklet 函数中(UI 线程)直接控制 scroll-view 滚动

核心概念

三大 API 族群

API 族群获取方式线程最低基础库
ScrollViewContextNodesRef.node() + enhanced 属性逻辑线程2.14.4
DraggableSheetContextNodesRef.node()逻辑线程3.2.0
worklet.scrollViewContextNodesRef.ref() + SharedValueUI 线程3.3.0

获取实例

// ScrollViewContext(需开启 enhanced)
wx.createSelectorQuery().select('#scrollview').node()
  .exec(res => { const ctx = res[0].node })

// DraggableSheetContext
wx.createSelectorQuery().select('.sheet').node()
  .exec(res => { const ctx = res[0].node })

// worklet.scrollViewContext(通过 ref)
this.scrollRef = wx.worklet.shared()
this.createSelectorQuery().select('.scrollable')
  .ref(res => { this.scrollRef.value = res.ref }).exec()

文档索引

根据需求快速定位(路径相对于 references/):

Sponsors

Details

Repository
github.com/wechat-miniprogram/skyline-skills
Category
Backend & APIs
First seen
Jun 3, 2026

More from wechat-miniprogram/skyline-skills

All 7
1product-on-purpose avatardeliver-edge-casesproduct-on-purpose/pm-skillsDocuments edge cases, error states, boundary conditions, race conditions, and recovery paths for a feature - the systematic catalog of what can go wrong and the934skills.sh installs
2aj-geddes avatarapi-contract-testingaj-geddes/useful-ai-promptsVerify API contracts between services to ensure compatibility and prevent breaking changes. Use for contract testing, Pact, API contract validation, schema vali926skills.sh installs
3letz-ai avatarletzai-apiletz-ai/letzai-skillletzai api914skills.sh installs
4ruvnet avatarapi-docsruvnet/rufloGenerate API documentation from source code with JSDoc and OpenAPI support893skills.sh installs
5mindrally avataropenai-api-developmentmindrally/skillsExpert guidance for OpenAI API development including GPT models, Assistants API, function calling, embeddings, and best practices for production applications.888skills.sh installs
6alirezarezvani avatardatabase-designeralirezarezvani/claude-skillsUse when the user asks to design database schemas, plan data migrations, optimize queries, choose between SQL and NoSQL, or model data relationships.858skills.sh installs