ui/Scroller
Unstyled scroller components and behaviors to be customized by a theme or application.
Members
Section titled “Members ”Scroller Component
Section titled “Scroller   Component ”An unstyled scroller.
Example:
<Scroller>Scroll me.</Scroller> Extends:
ui/Scrollerui/Scroller.ScrollerBasic
Properties
cbScrollTo
Section titled “cbScrollTo”A callback function that receives a reference to the scrollTo feature.
Once received, the scrollTo method can be called as an imperative interface.
{position: {x, y}} - Pixel value for x and/or y position
{align} - Where the scroll area should be aligned. Values are:
'left','right','top','bottom','topleft','topright','bottomleft', and'bottomright'.{node} - Node to scroll into view
{animate} - When
true, scroll occurs with animation. Whenfalse, no animation occurs.{focus} - When
true, attempts to focus item after scroll. Only valid when scrolling bynode.
Note: Only specify one of:
position,align,node
Example:
// If you set cbScrollTo prop like below;
cbScrollTo: (fn) => {this.scrollTo = fn;}
// You can simply call like below;
this.scrollTo({align: 'top'}); // scroll to the topdirection
Section titled “direction”Direction of the scroller.
Valid values are:
'both','horizontal', and'vertical'.
horizontalScrollbar
Section titled “horizontalScrollbar”Specifies how to show horizontal scrollbar.
Valid values are:
'auto','visible', and'hidden'.
noScrollByWheel
Section titled “noScrollByWheel”Prevents scroll by wheeling on the scroller.
Default: falseonScroll
Section titled “onScroll”Called when scrolling.
Passes scrollLeft, scrollTop.
It is not recommended to set this prop since it can cause performance degradation.
Use onScrollStart or onScrollStop instead.
onScrollStart
Section titled “onScrollStart”Called when scroll starts.
Passes scrollLeft and scrollTop.
Example:
onScrollStart = ({scrollLeft, scrollTop}) => {
// do something with scrollLeft and scrollTop
}
render = () => (
<Scroller
...
onScrollStart={this.onScrollStart}
...
/>
)onScrollStop
Section titled “onScrollStop”Called when scroll stops.
Passes scrollLeft and scrollTop.
Example:
onScrollStop = ({scrollLeft, scrollTop}) => {
// do something with scrollLeft and scrollTop
}
render = () => (
<Scroller
...
onScrollStop={this.onScrollStop}
...
/>
)scrollMode
Section titled “scrollMode”Specifies how to scroll.
Valid values are:
'translate','native'.
verticalScrollbar
Section titled “verticalScrollbar”Specifies how to show vertical scrollbar.
Valid values are:
'auto','visible', and'hidden'.
ScrollerBasic Component
Section titled “ScrollerBasic   Component ”An unstyled base scroller component.
Properties
direction
Section titled “direction”Direction of the scroller.
Valid values are:
'both','horizontal', and'vertical'.
animateScroll
Section titled “animateScroll”Programmatically animates the native scroll position of node toward the target left/top
offsets using requestAnimationFrame. It computes the scroll direction on each axis, then repeatedly
calls scrollBy with a dynamic step (10% of remaining distance, minimum 8px) until the target is reached
or 1s has elapsed. Used as a Chrome fallback when repeating a smooth scroll.