sandstone/ Scroller
Provides Sandstone-themed scroller components and behaviors.
import Scroller from '@enact/sandstone/Scroller';Members
ScrollerComponent
A Sandstone-styled Scroller, useScroll applied.
Usage:
<Scroller>Scroll me.</Scroller>import Scroller from '@enact/sandstone/Scroller';Properties
The "aria-label" for the Scroller.
When
aria-labelis set andfocusableScrollbarisbyEnter, it will be used instead to provide an accessibility label for the Scroller.A callback function that receives a reference to the
scrollTofeature.Once received, the
scrollTomethod 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,nodeExample:
// 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 topDisable voice control feature of component.
Activates the component for voice control.
The voice control group label.
Direction of the scroller.
Default: 'both'Enables editing items in the scroller. You can specify props for editable scroller as an object. See the details in EditableShape
Adds fade-out effect on the scroller.
Set this to
trueonly if the content has no spottable but text.Note: Fade-out effect will not show if the
directionis set toboth.Default: falseAllows 5-way navigation to the scroll thumb.
By default, 5-way will not move focus to the scroll thumb. If
true, the scroll thumb will get focus by directional keys. If'byEnter', scroll thumb will get focus first by directional keys, then the scroll body will get focus by enter key or back key pressed on scroll thumb.Default: falseSets the hint string read when focusing the scroll thumb in the horizontal scroll bar.
Default: $L('scroll up or down with up down button')Specifies how to show horizontal scrollbar.
Default: 'auto'Enables scroll by hover on edges in scroll direction.
Unique identifier for the component.
When defined and when the
Scrolleris within a Panel, theScrollerwill store its scroll position and restore that position when returning to thePanel.Prevents scroll by wheeling on the scroller.
Default: falseCalled when scrolling.
Passes
scrollLeft,scrollTop. It is not recommended to set this prop since it can cause performance degradation. UseonScrollStartoronScrollStopinstead.Called when scroll starts.
Passes
scrollLeftandscrollTop.Example:
onScrollStart = ({scrollLeft, scrollTop}) => { // do something with scrollLeft and scrollTop } render = () => ( <Scroller ... onScrollStart={this.onScrollStart} ... /> )Called when scroll stops.
Passes
scrollLeftandscrollTop.Example:
onScrollStop = ({scrollLeft, scrollTop}) => { // do something with scrollLeft and scrollTop } render = () => ( <Scroller ... onScrollStop={this.onScrollStop} ... /> )Specifies how to scroll.
Default: 'native'Customizes the component by mapping the supplied collection of CSS class names to the corresponding internal elements and states of this component.
The following classes are supported:
scrollbarTrack- The scrollbarTrack component classthumb- The scrollbar thumb component class
Sets the hint string read when focusing the scroll thumb in the vertical scroll bar.
Default: $L('scroll left or right with left right button')Specifies how to show vertical scrollbar.
Default: 'auto'
EditableWrapperComponent
A Sandstone-styled EditableWrapper.
import {EditableWrapper} from '@enact/sandstone/Scroller';Properties
Enables editing items in the scroller. You can specify props for editable scroller as an object. See the datails in EditableShape
Obtains a reference to the scroll container handle.
Obtains a reference to the scroll container node.
Obtains a reference to the scroll content node.
Type Definitions
EditableShapeObject
The shape for editable of Scroller.
- onComplete •
- Function
The callback function called when editing is finished. It has an event object contains
ordersarray which app can use for repopulate items.- centered
- Boolean
Centers the contents of the scroller.
- css
- Object
Customizes the component by mapping the supplied collection of CSS class names to the corresponding internal elements and states of this component. The following classes are supported:
wrapper- The content wrapper component classselected- The selected item class
- removeItemFuncRef
- FunctionObject
Obtains a reference to
removeItemfunction. If you would like to remove an item, you can get the reference toremoveItemfunction viauseRef.