<scroll-coordinator> XElement
<scroll-coordinator> is a nested scroll coordination component for implementing coordinated scrolling between multiple scrollable containers. It is commonly used in sticky-header page layouts found in mainstream apps, and is typically combined with <viewpager> and <list> to build composite scenarios involving nested scrolling and tabbed paging.
<scroll-coordinator> coordinates nested structures through <scroll-coordinator-header> and <scroll-coordinator-slot>, achieving the following behavior:
- When the outer layer scrolls to the bottom, scroll control is automatically handed over to the inner layer
- When the inner layer scrolls to the top, scroll control is automatically returned to the outer layer
- The handover of scroll control is smooth and seamless
Usage
The core layout requirement of <scroll-coordinator> is to control via CSS: scroll-coordinator height == scroll-coordinator-slot height + toolbar height.
Layout Guidelines
<scroll-coordinator>: vertical flex layout,display: flex; flex-direction: column;<scroll-coordinator-header>: out of normal flow,position: absolute;<scroll-coordinator-toolbar>: participates in layout,display: flex;<scroll-coordinator-slot>: fills remaining space,flex: 1;
Vertical Coordinated Scrolling
A
<list>must be placed inside<scroll-coordinator-slot>to enable vertical coordinated scrolling
Horizontal Paged Scrolling
<scroll-coordinator-slot>can detect<viewpager>page switch events and re-bind the nested scroll relationship with the<list>inside.
Full-Page Pull-to-Refresh
Wrap
<scroll-coordinator>with<refresh>and setrefresh-mode="fold" bounces={true}to enable full-page pull-to-refresh
Per-Tab Pull-to-Refresh
Wrap the
<list>inside<scroll-coordinator-slot>with<refresh>and setrefresh-mode="page" bounces={false}to enable per-tab pull-to-refresh
Attributes
android-nested-scroll-as-child
Android
Android foldview is based on CoordinateLayout, but it only implements NestedScrollingParent, so it not support to nested scroll as child in other scrolling widget, set this property true to make it work.
bounces
iOS
Harmony
Enable the bounce effect when the coordinator scrolls past its boundary.
enable-scroll
Android
iOS
Clay
Harmony
Set whether the coordinator can scroll vertically.
enable-scroll-bar
iOS
Harmony
Set whether the scrollbar is visible during coordinator scrolling.
granularity
Android
iOS
Clay
Harmony
The event response granularity of bindoffset, once the scroll distance exceeds the scrollable distance of granularity, it may trigger. It defaults to 0.01, but it doesn't necessarily trigger every 0.01.
header-over-slot
Android
iOS
Clay
Harmony
This property controls whether the header hierarchy higher than the slot, when header is overflow, it will be displayed on top of the slot. Otherwise, it will be displayed below the slot. It is better to set this property explicitly, rather than use the default value.
ios-force-scroll-detach
iOS
Whether to force the nested-vertical-scroll-behavior invalid of foldview on iOS, the setting is ineffective for other platforms
ios-scrolls-to-top
iOS
When the user taps the status bar, the scroll view beneath the touch which is closest to the status bar will be scrolled to top. iOS feature only.
refresh-mode
iOS
The pull-to-refresh mode of foldview, none (none, default value), page (category pull-to-refresh), fold (overall pull-to-refresh)
Events
Frontend can bind corresponding event callbacks to listen for runtime behaviors of the element, as shown below.
bindoffset
Android
iOS
Clay
Harmony
Callback for folding progress
Methods
Frontend can invoke component methods via the SelectorQuery API.
setFoldExpanded
Compatibility
LCD tables only load in the browser



