/* * Copyright (c) 2021-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @file * @kit ArkUI */ /*** if arkts 1.2 */ import { BarState, Edge, Color, EdgeEffect, ScrollSource ,Curve} from './enums' import { ICurve, RectResult, ScrollableCommonMethod, EdgeEffectOptions, NestedScrollOptions,CommonMethod } from './common' import { Dimension, Length, VoidCallback, Resource, LengthMetrics } from './units' import { ScrollSnapAlign, ScrollState } from './list' /*** endif */ /** * Content scroll direction. * * @enum { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Content scroll direction. * * @enum { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Enumerates the scrolling directions. * * @enum { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ declare enum ScrollDirection { /** * Vertical scrolling is supported. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Vertical scrolling is supported. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Only vertical scrolling is supported. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ Vertical, /** * Horizontal scrolling is supported. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Horizontal scrolling is supported. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Only horizontal scrolling is supported. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ Horizontal, /** * Vertical or horizontal scrolling is supported. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 * @deprecated since 9 */ Free, /** * Non-scrollable. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Non-scrollable. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Scrolling is disabled. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ None, /** * Free scrolling is supported. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 */ FREE = 4, } /** * ScrollAlign. * * @enum { number } ScrollAlign * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Enumerates alignment modes. * * @enum { number } ScrollAlign * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ declare enum ScrollAlign { /** * Start position alignment. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * The start edge of the list item is flush with the start edge of the list. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ START, /** * Center alignment. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * The list item is centered along the main axis of the list. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ CENTER, /** * End position alignment. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * The end edge of the list item is flush with the end edge of the list. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ END, /** * Scroll the minimum distance to fully display the specified item. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * The list item is automatically aligned. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ AUTO, } /** * Represents the offset values resulting from a scroll operation. * * @interface OffsetResult * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ declare interface OffsetResult { /** * Horizontal scrolling offset. * * @type { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ xOffset: number; /** * Vertical scrolling offset. * * @type { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ yOffset: number; } /** * Provides parameters for scrolling to the edge of a scrollable container. * * @interface ScrollEdgeOptions * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ declare interface ScrollEdgeOptions { /** * Fixed velocity for scrolling to the edge of the container. * If the value specified is less than or equal to 0, the parameter will not take effect. * * @type { ?number } * @default 0vp/s * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ velocity?: number; } /** * Provides parameters for scrolling to a specific index. * * @interface ScrollToIndexOptions * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ declare interface ScrollToIndexOptions { /** * Extra offset for scrolling to a specified index. * * @type { ?LengthMetrics } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ extraOffset?: LengthMetrics; } /** * Provides parameters for customizing scroll animations. * * @interface ScrollAnimationOptions * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ declare interface ScrollAnimationOptions { /** * Scrolling duration. * *

NOTE *
A value less than 0 evaluates to the default value. *

* * @type { ?number } * @default 1000 * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ duration?: number; /** * Scrolling curve. * * @type { ?(Curve | ICurve) } * @default Curve.Ease * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ curve?: Curve | ICurve; /** * Whether to enable overscroll. * *

NOTE *
Scrolling can exceed the boundary and initiate a bounce animation when this parameter is set to true, * and the component's edgeEffect attribute is set to EdgeEffect.Spring. *

* * @type { ?boolean } * @default false * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ canOverScroll?: boolean; } /** * Provides parameters for setting the initial scrolling offset. * * @interface OffsetOptions * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ declare interface OffsetOptions { /** * Horizontal scrolling offset. * * @type { ?Dimension } * @default 0 * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ xOffset?: Dimension; /** * Vertical scrolling offset. * * @type { ?Dimension } * @default 0 * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ yOffset?: Dimension; } /** * Defines a UIScrollableCommonEvent which is used to set different common event to target component. * * @extends UIScrollableCommonEvent * @interface UIScrollEvent * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 19 */ declare interface UIScrollEvent extends UIScrollableCommonEvent { /** * Set or reset the callback which is triggered when the Scroll will scroll. * * @param { ScrollOnWillScrollCallback | undefined } callback - callback function, triggered when * the Scroll will scroll. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 19 */ setOnWillScroll(callback: ScrollOnWillScrollCallback | undefined): void; /** * Set or reset the callback which is triggered when the Scroll did scroll. * * @param { ScrollOnScrollCallback | undefined } callback - callback function, triggered when the Scroll did scroll. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 19 */ setOnDidScroll(callback: ScrollOnScrollCallback | undefined): void; } /** * Scroller * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Scroller * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Defines a controller for scrollable container components. * *

NOTE *
1. The binding of a Scroller instance to a scrollable container component occurs during the component creation phase. *
2. Scroller APIs can only be effectively called after the Scroller instance is bound to a scrollable container component. * Otherwise, depending on the API called, it may have no effect or throw an exception. *
3. For example, with aboutToAppear, this callback is executed after a new instance of a custom component is * created and before its build() method is called. * Therefore, if a scrollable component is defined within the build method of a custom component, * the internal scrollable component has not yet been created during the aboutToAppear callback * of that custom component, and therefore the Scroller APIs cannot be called effectively. *

* * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ declare class Scroller { /** * constructor. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * constructor. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * A constructor used to create a Scroller object. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ constructor(); /** * Called when the setting slides to the specified position. * * @param { object } value * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Called when the setting slides to the specified position. * * @param { object } value * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when the setting slides to the specified position. * * @param { object } value * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 11 */ /** * Scrolls to the specified position. * Anonymous Object Rectification. * * @param { ScrollOptions } options - Parameters for scrolling to the specified position. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ scrollTo(options: ScrollOptions); /** * Called when the setting slides to the specified position. * * @param { ScrollOptions } options - scroll options * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ scrollTo(options: ScrollOptions): void; /** * Called when scrolling to the edge of the container. * * @param { Edge } value * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Called when scrolling to the edge of the container. * * @param { Edge } value * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when scrolling to the edge of the container. * * @param { Edge } value * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 11 */ /** * Scrolls to the edge of the container, regardless of the scroll axis direction. * * @param { Edge } value - Edge position to scroll to. *
Atomic service API: This API can be used in atomic services since API version 11. * @param { ScrollEdgeOptions } [options] - Mode of scrolling to the edge position. *
Atomic service API: This API can be used in atomic services since API version 12. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ scrollEdge(value: Edge, options?: ScrollEdgeOptions); /** * Called when scrolling to the edge of the container. * * @param { Edge } value - Edge type of the container. * @param { ScrollEdgeOptions } [options] - Options of scrolling to edge. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ scrollEdge(value: Edge, options?: ScrollEdgeOptions): void; /** * Performs inertial scrolling based on the initial velocity passed in. * * @param { number } velocity - Initial velocity of inertial scrolling. Unit: vp/s *
NOTE *
If the value specified is 0, it is considered as invalid, and the scrolling for this instance will not take effect. * A positive value indicates scrolling towards the top, while a negative value indicates scrolling towards the bottom. * @throws { BusinessError } 401 - Parameter error. Possible causes: *
1. Mandatory parameters are left unspecified. *
2. Incorrect parameters types. *
3. Parameter verification failed. * @throws { BusinessError } 100004 - Controller not bound to component. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ fling(velocity: number): void; /** * Called when page turning mode is set. * * @param { object } value * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ /** * Called when page turning mode is set. * * @param { object } value * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when page turning mode is set. * * @param { object } value * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 11 */ /** * Scrolls to the next or previous page. * * @param { ScrollPageOptions } value - Page turning mode. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 14 */ scrollPage(value: ScrollPageOptions); /** * Called when page turning mode is set. * * @param { ScrollPageOptions } value * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ scrollPage(value: ScrollPageOptions): void; /** * Scrolls to the next or previous page. * * @param { boolean } next - Whether to turn to the next page. * The value true means to scroll to the next page, and false means to scroll to the previous page. * @param { Axis } direction - Scrolling direction: horizontal or vertical. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 * @deprecated since 9 */ scrollPage(value: { next: boolean; direction?: Axis }); /** * Called when viewing the scroll offset. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Called when viewing the scroll offset. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Obtains the current scrolling offset. * * @returns { OffsetResult } Returns the current scrolling offset. If the scroller not bound to a component, the return value is void. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ currentOffset() : OffsetResult; /** * Called when sliding to the specified index. * * @param { number } value * @param { boolean } smooth * @param { ScrollAlign } align * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Called when sliding to the specified index. * * @param { number } value - Index to jump to. * @param { boolean } smooth - If true, scroll to index item with animation. If false, scroll to index item without animation. * @param { ScrollAlign } align - Sets the alignment mode of a specified index. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when sliding to the specified index. * * @param { number } value - Index to jump to. * @param { boolean } smooth - If true, scroll to index item with animation. If false, scroll to index item without animation. * @param { ScrollAlign } align - Sets the alignment mode of a specified index. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 11 */ /** * Scrolls to a specified index, with support for setting an extra offset for the scroll. * *

NOTE *
This API only works for the ArcList, Grid, List, and WaterFlow components. *

* * @param { number } value - Index of the item to be scrolled to in the container. *
NOTE *
If the value set is a negative value or greater than the maximum index of the items in the container, * the value is deemed abnormal, and no scrolling will be performed. * @param { boolean } [smooth] - Whether to enable the smooth animation for scrolling to the item with the specified index. * The value true means to enable that the smooth animation, and false means the opposite.
Default value: false * @param { ScrollAlign } [align] - How the list item to scroll to is aligned with the container. *
Default value when the container is List: ScrollAlign.START *
Default value when the container is Grid: ScrollAlign.AUTO *
Default value when the container is WaterFlow: ScrollAlign.START *
NOTE *
This parameter is only available for the List, Grid, and WaterFlow components. * @param { ScrollToIndexOptions } [options] - Options for scrolling to a specified index, * for example, an extra offset for the scroll.
Default value: 0, in vp * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ scrollToIndex(value: number, smooth?: boolean, align?: ScrollAlign, options?: ScrollToIndexOptions); /** * Scroll to the specified index. * * @param { number } value - Index to jump to. * @param { boolean } [smooth] - If true, scroll to index item with animation. If false, scroll to index item without animation. * @param { ScrollAlign } [align] - Sets the alignment mode of a specified index. * @param { ScrollToIndexOptions } [options] - Sets the options of a specified index, such as extra offset. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ scrollToIndex(value: number, smooth?: boolean, align?: ScrollAlign, options?: ScrollToIndexOptions): void; /** * Called when the setting slides by offset. * * @param { Length } dx * @param { Length } dy * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ /** * Called when the setting slides by offset. * * @param { Length } dx * @param { Length } dy * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Scrolls by the specified amount. * *

NOTE *
This API is available for the ArcList, Scroll, List, Grid, and WaterFlow components. *

* * @param { Length } dx - Amount to scroll by in the horizontal direction. The percentage format is not supported. *
Value range: (-∞, +∞). * @param { Length } dy - Amount to scroll by in the vertical direction. The percentage format is not supported. *
Value range: (-∞, +∞). * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 11 */ scrollBy(dx: Length, dy: Length); /** * Called when the setting slides by offset. * * @param { Length } dx * @param { Length } dy * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ scrollBy(dx: Length, dy: Length): void; /** * Indicates whether the component scrolls to the end position. * * @returns { boolean } Returns whether the component scrolls to the end position. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Checks whether the component has scrolled to the bottom. * *

NOTE *
This API is available for the ArcList, Scroll, List, Grid, and WaterFlow components. *

* * @returns { boolean } Returns whether the component scrolls to the end position. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ isAtEnd(): boolean; /** * Get child item size and position. * * @param { number } index - Index of the item. * @returns { RectResult } Returns the size and position. * @throws { BusinessError } 401 - Parameter error. Possible causes: *
1. Mandatory parameters are left unspecified. *
2. Incorrect parameters types. *
3. Parameter verification failed. * @throws { BusinessError } 100004 - Controller not bound to component. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * Obtains the size and position of a child component relative to its container. * *

NOTE *
- The value of index must be the index of a child component visible in the display area. * Otherwise, the value is considered invalid. *
- The value of index must be the index of a child component visible in the display area. Otherwise, * the value is considered invalid. *

* * @param { number } index - Index of the target child component. * @returns { RectResult } Returns the size and position. * @throws { BusinessError } 401 - Parameter error. Possible causes: *
1. Mandatory parameters are left unspecified. *
2. Incorrect parameters types. *
3. Parameter verification failed. * @throws { BusinessError } 100004 - Controller not bound to component. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ getItemRect(index: number): RectResult; /** * Obtains the index of a child component based on coordinates. * *

NOTE *
The returned index is -1 for invalid coordinates. *

* * @param { number } x - X-coordinate, in vp. * @param { number } y - Y-coordinate, in vp. * @returns { number } Index of the item. * @throws { BusinessError } 401 - Parameter error. Possible causes: *
1. Mandatory parameters are left unspecified. *
2. Incorrect parameters types. *
3. Parameter verification failed. * @throws { BusinessError } 100004 - The controller not bound to component. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'14','1.2':'20'} * @arkts 1.1&1.2 */ getItemIndex(x: number, y: number): number; } /** * Provides parameters for scrolling to a specific position in a scrollable container. * * @interface ScrollOptions * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ declare interface ScrollOptions { /** * The X-axis offset. * * @type { number | string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * The X-axis offset. * * @type { number | string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 11 */ /** * Horizontal scrolling offset. * Anonymous Object Rectification. * *

NOTE *
This parameter cannot be set in percentage. *
If the value is less than 0, the offset will be 0 for non-animated scrolling. * Animated scrolling stops at the starting position by default. * By setting the animation parameter, you can enable a bounce effect when the scrolling goes beyond the boundary. *
This parameter takes effect only when the scroll axis is the x-axis. *

* * @type { number | string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ xOffset: number | string; /** * The Y-axis offset. * * @type { number | string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * The Y-axis offset. * * @type { number | string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 11 */ /** * Vertical scrolling offset. * Anonymous Object Rectification. * *

NOTE *
This parameter cannot be set in percentage. *
If the value is less than 0, the offset will be 0 for non-animated scrolling. * Animated scrolling stops at the starting position by default. * By setting the animation parameter, you can enable a bounce effect when the scrolling goes beyond the boundary. *
This parameter takes effect only when the scroll axis is the y-axis. *

* * @type { number | string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ yOffset: number | string; /** * Descriptive animation. * * @type { ?({ duration?: number; curve?: Curve | ICurve } | boolean) } The object type provides custom animation parameters * and the boolean type enables default spring animation. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Descriptive animation. * * @type { ?({ duration?: number; curve?: Curve | ICurve } | boolean) } The object type provides custom animation parameters * and the boolean type enables default spring animation. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 11 */ /** * Descriptive animation. * * @type { ?( ScrollAnimationOptions | boolean) } The ScrollAnimationOptions type provides custom animation parameters * and the boolean type enables default spring animation. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ /** * Animation configuration * Anonymous Object Rectification. * *

NOTE *
Currently, the List, Scroll, Grid, and WaterFlow support the Boolean type and ICurve. *

* * @type { ?( ScrollAnimationOptions | boolean) } The ScrollAnimationOptions type provides custom animation parameters * and the boolean type enables default spring animation. * @default ScrollAnimationOptions: { duration: 1000, curve: Curve.Ease, canOverScroll: false } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ animation?: ScrollAnimationOptions | boolean; /** * Set whether the scroll target position can over the boundary. * * @type { ?boolean } whether the scroll target position can over the boundary. * @default false * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 */ canOverScroll?: boolean; } /** * Provides parameters for page scrolling behavior. * * @interface ScrollPageOptions * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'14','1.2':'20'} * @arkts 1.1&1.2 */ declare interface ScrollPageOptions { /** * Whether to turn to the next page.The value true means to scroll to the next page, * and false means to scroll to the previous page. * * @type { boolean } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'14','1.2':'20'} * @arkts 1.1&1.2 */ next: boolean; /** * Whether to enable the page-turning animation.The value true means to enable the page-turning animation, * and false means the opposite. * * @type { ?boolean } * @default false * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'14','1.2':'20'} * @arkts 1.1&1.2 */ animation?: boolean; } /** * Define scroll snap options * * @interface ScrollSnapOptions * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Defines a scroll snapping mode object. * * @interface ScrollSnapOptions * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ declare interface ScrollSnapOptions { /** * Set scroll snap alignment. * * @type { ScrollSnapAlign } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Alignment mode for the scroll snap position. * * @type { ScrollSnapAlign } * @default ScrollSnapAlign.NONE * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ snapAlign: ScrollSnapAlign; /** * Set snap positions. When the type of snapPositions is Dimension, Scroll content is paginated by an integer * multiple of snapPositions. When the type of snapPositions is Array, Scroll content is paginated based * on the array of snapPositions. * * @type { ?(Dimension | Array) } * @default 100% * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Pagination points for scroll snapping. * *

NOTE *
1. If the value is of the Dimension type, it indicates the size of each page, and the system will paginate based on this size. *
2. If the value is of the Array\ type, each Dimension represents a pagination point, * and the system will paginate accordingly. Each Dimension value must be within the [0, scrollable distance] range. *
3. If this parameter is not set or Dimension is set to a value less than or equal to 0, the value is regarded as an invalid value. * In this case, there is no scroll snapping. When the value is of the Array\ type, the items in the array must be monotonically increasing. *
4. When the value is a percentage, the actual size is the product of the viewport of the Scroll component and the percentage value. *

* * @type { ?(Dimension | Array) } * @default 100% * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ snapPagination?: Dimension | Array; /** * Set whether the beginning of the Scroll content counts an a snap. * * @type { ?boolean } * @default true * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Whether to enable the snap to start feature. When scroll snapping is defined for the Scroll component, * setting this parameter to false enables the component to scroll between the start and the first page. * *

NOTE *
2. This attribute takes effect only when snapPagination is set to a value of the Array\ type; * it does not work with values of the Dimension type. *

* * @type { ?boolean } * @default true * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ enableSnapToStart?: boolean; /** * Set whether the end of the Scroll content counts an a snap. * * @type { ?boolean } * @default true * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Whether to enable the snap to end feature. When scroll snapping is defined for the Scroll component, * setting this parameter to false enables the component to scroll between the end and the last page. * *

NOTE *
2. This attribute takes effect only when snapPagination is set to a value of the Array\ type; * it does not work with values of the Dimension type. *

* * @type { ?boolean } * @default true * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ enableSnapToEnd?: boolean; } /** * Provides interfaces for scrollable containers. * * @interface ScrollInterface * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Provides interfaces for scrollable containers. * * @interface ScrollInterface * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Provides interfaces for scrollable containers. * * @interface ScrollInterface * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ interface ScrollInterface { /** * Called when a scrollable container is set. * * @param { Scroller } scroller * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Called when a scrollable container is set. * * @param { Scroller } scroller * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when a scrollable container is set. * * @param { Scroller } scroller * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ (scroller?: Scroller): ScrollAttribute; } /** * Represents the callback triggered when scrolling reaches an edge. * * @typedef { function } OnScrollEdgeCallback * @param { Edge } side - Edge position to scroll to. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ declare type OnScrollEdgeCallback = (side: Edge) => void; /** * The data returned by the event handler when onScrollFrameBegin. * * @interface OnScrollFrameBeginHandlerResult * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ interface OnScrollFrameBeginHandlerResult { /** * Actual sliding amount, unit vp. * * @type { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ /** * Actual sliding amount, unit vp. * * @type { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Actual sliding amount, unit vp. * * @type { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 11 */ /** * Actual scroll offset. * Anonymous Object Rectification. * * @type { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ offsetRemain: number; } /** * Represents the callback triggered before each frame scrolling starts. * * @typedef { function } OnScrollFrameBeginCallback * @param { number } offset - Amount to scroll by, in vp. * @param { ScrollState } state - Current scroll state. * @returns { OnScrollFrameBeginHandlerResult } data - the scroll data return by handler * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ declare type OnScrollFrameBeginCallback = (offset: number, state: ScrollState) => OnScrollFrameBeginHandlerResult; /** * Defines the scroll attribute functions. * * @extends CommonMethod * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Defines the scroll attribute functions. * * @extends CommonMethod * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Defines the scroll attribute functions. * * @extends ScrollableCommonMethod * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ declare class ScrollAttribute extends ScrollableCommonMethod { /** * Called when the scroll method is slid. * * @param { ScrollDirection } value * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Called when the scroll method is slid. * * @param { ScrollDirection } value * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Sets the scrolling direction. * * @param { ScrollDirection } value - Scrolling direction.
Default value: ScrollDirection.Vertical * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ scrollable(value: ScrollDirection): ScrollAttribute; /** * Set maximum zoom scale. * * @param { number } scale - Set maximum zoom scale. *
Default value: 1. *
Value range: (0, +∞). If this parameter is set to a value less than or equal to 0, the default value is used. * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 */ maxZoomScale(scale: number): ScrollAttribute; /** * Set minimum zoom scale. * * @param { number } scale - Set minimum zoom scale. *
Default value: 1. *
Value range: (0, maxZoomScale]. * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 */ minZoomScale(scale: number): ScrollAttribute; /** * Current zoom scale. * This parameter supports !! for two-way binding of variables. * * @param { number } scale - Current zoom scale. *
Default value: 1. *
Value range: (0, +∞). * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 */ zoomScale(scale: number): ScrollAttribute; /** * Enable bounces zoom scale. * This parameter supports !! for two-way binding of variables. * * @param { boolean } enable - Enable bounces zoom scale. *
Default value: true. * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 */ enableBouncesZoom(enable: boolean): ScrollAttribute; /** * Called when the setting slides to the specified position. * * @param { function } event * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Called when the setting slides to the specified position. * * @param { function } event * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Triggered to return the horizontal and vertical offsets, in vp, during scrolling when the specified scroll event occurs. * *

NOTE *
1. This event is triggered when scrolling is started by the Scroll component or other input settings, * such as keyboard and mouse operations. *
2. This event is triggered when the controller API is called. *
3. This event supports the out-of-bounds bounce effect. *

* * @param { function } event * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 11 * @deprecated since 12 * @useinstead scroll/Scroll#onWillScroll * */ onScroll(event: (xOffset: number, yOffset: number) => void): ScrollAttribute; /** * Triggered before scrolling. * *

NOTE *
1. This event is triggered when scrolling is started by the Scroll component or other input settings, * such as keyboard and mouse operations. *
2. This event is triggered when the controller API is called. *
3. This event supports the out-of-bounds bounce effect. *

* * @param { ScrollOnWillScrollCallback } handler - Callback triggered before scrolling. * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ onWillScroll(handler: ScrollOnWillScrollCallback): ScrollAttribute; /** * Triggered when the Scroll component scrolls. * *

NOTE *
1. This event is triggered when scrolling is started by the Scroll component or other input settings, * such as keyboard and mouse operations. *
2. This event is triggered when the controller API is called. *
3. This event supports the out-of-bounds bounce effect. *

* * @param { ScrollOnScrollCallback } handler - Callback triggered when the Scroll component scrolls. * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ onDidScroll(handler: ScrollOnScrollCallback): ScrollAttribute; /** * Called when scrolling to the edge of the container. * * @param { function } event * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Called when scrolling to the edge of the container. * * @param { function } event * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when scrolling to the edge of the container. * * @param { function } event * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 11 */ /** * Triggered when scrolling reaches the edge. * Anonymous Object Rectification. * *

NOTE *
1. This event is triggered when scrolling reaches the edge after being started by the Scroll component or other input settings, * such as keyboard and mouse operations. *
2. This event is triggered when the controller API is called. *
3. This event supports the out-of-bounds bounce effect. *

* * @param { OnScrollEdgeCallback } event - Edge position to scroll to. * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ onScrollEdge(event: OnScrollEdgeCallback): ScrollAttribute; /** * Called when scrolling start. * * @param { function } event * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ /** * Called when scrolling start. * * @param { function } event * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when scrolling start. * * @param { function } event * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 11 */ /** * Called when scrolling start. * Anonymous Object Rectification. * *

NOTE *
1. This event is triggered when scrolling is started by the Scroll component or other input settings, such as keyboard and mouse operations. *
2. This event is triggered when the controller API is called, accompanied by a transition animation. *

* * @param { VoidCallback } event - Callback triggered when scrolling starts. * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ onScrollStart(event: VoidCallback): ScrollAttribute; /** * Triggered when scrolling stops. * *

NOTE *
1. This event is triggered when scrolling is stopped by the Scroll component or other input settings, such as keyboard and mouse operations. *
2. This event is triggered when the controller API is called, accompanied by a transition animation. *

* * @param { function } event * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 * @deprecated since 9 * @useinstead scroll/Scroll#onScrollStop */ onScrollEnd(event: () => void): ScrollAttribute; /** * Called when scrolling has stopped. * * @param { function } event * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ /** * Called when scrolling has stopped. * * @param { function } event * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when scrolling has stopped. * * @param { function } event * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 11 */ /** * Called when scrolling has stopped. * Anonymous Object Rectification. * *

NOTE *
1. This event is triggered when scrolling is stopped by the Scroll component or other input settings, such as keyboard and mouse operations. *
2. This event is triggered when the controller API is called, accompanied by a transition animation. *

* * @param { VoidCallback } event - Callback triggered when scrolling stops. * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ onScrollStop(event: VoidCallback): ScrollAttribute; /** * Called when the Scroll did zoom. * * @param { ScrollOnDidZoomCallback } event - callback of zoom. * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 */ onDidZoom(event: ScrollOnDidZoomCallback): ScrollAttribute; /** * Called when zooming has stated. * * @param { VoidCallback } event - Zoom start callback. * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 */ onZoomStart(event: VoidCallback): ScrollAttribute; /** * Called when zooming has stopped. * * @param { VoidCallback } event - Zoom stop callback. * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 */ onZoomStop(event: VoidCallback): ScrollAttribute; /** * Called when the status of the scroll bar is set. * * @param { BarState } barState * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Called when the status of the scroll bar is set. * * @param { BarState } barState * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Sets the scrollbar state. * * @param { BarState } barState - Scrollbar state.
Default value: BarState.Auto * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ scrollBar(barState: BarState): ScrollAttribute; /** * Called when the color of the scroll bar is set. * * @param { Color | number | string } color * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Called when the color of the scroll bar is set. * * @param { Color | number | string } color * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Sets the scrollbar color. * * @param { Color | number | string } color - Scrollbar color.
Default value: '#66182431' * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ scrollBarColor(color: Color | number | string): ScrollAttribute; /** * Called when the width of the scroll bar is set. * * @param { number | string } value * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Called when the width of the scroll bar is set. * * @param { number | string } value * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Sets the scrollbar width. * * @param { number | string } value - Scrollbar width.
Default value: 4
Unit: vp * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ scrollBarWidth(value: number | string): ScrollAttribute; /** * Called when the sliding effect is set. * * @param { EdgeEffect } edgeEffect * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Called when the sliding effect is set. * * @param { EdgeEffect } edgeEffect * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Sets the effect used when the scroll boundary is reached. * * @param { EdgeEffect } edgeEffect - Effect used when the scroll boundary is reached. The spring and shadow effects are supported. *
Default value: EdgeEffect.None * @param { EdgeEffectOptions } options - Whether to enable the scroll effect when the component content is smaller than the component itself. * The value { alwaysEnabled: true } means to enable the scroll effect, and { alwaysEnabled: false } means the opposite. *
Default value: { alwaysEnabled: true } * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ edgeEffect(edgeEffect: EdgeEffect, options?: EdgeEffectOptions): ScrollAttribute; /** * Called when scrolling begin each frame. * * @param { function } event * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ /** * Called when scrolling begin each frame. * * @param { function } event * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Called when scrolling begin each frame. * * @param { function } event * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 11 */ /** * Triggered when each frame scrolling starts. * Anonymous Object Rectification. * * @param { OnScrollFrameBeginCallback } event - Callback triggered when each frame scrolling starts. * @returns { ScrollAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ onScrollFrameBegin(event: OnScrollFrameBeginCallback): ScrollAttribute; /** * Called to setting the nested scroll options. * * @param { NestedScrollOptions } value - options for nested scrolling. * @returns { ScrollAttribute } the attribute of the scroll. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Sets the nested scrolling options. You can set the nested scrolling mode in the forward and backward directions * to implement scrolling linkage with the parent component. * * @param { NestedScrollOptions } value - Nested scrolling options. *
Default value: { scrollForward: NestedScrollMode.SELF_ONLY, scrollBackward: NestedScrollMode.SELF_ONLY } * @returns { ScrollAttribute } the attribute of the scroll. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ nestedScroll(value: NestedScrollOptions): ScrollAttribute; /** * Called when setting whether to enable scroll by gesture or mouse. * * @param { boolean } value * @returns { ScrollAttribute } The attribute of the scroll * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Sets whether to support scroll gestures. When this attribute is set to false, * scrolling by finger or mouse is not supported, but the scroll controller API is not affected. * * @param { boolean } value - Whether to support scroll gestures.
Default value: true * @returns { ScrollAttribute } The attribute of the scroll * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ enableScrollInteraction(value: boolean): ScrollAttribute; /** * Called to setting the friction. * * @param { number | Resource } value - options for scrolling friction. * @returns { ScrollAttribute } the attribute of the scroll. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Sets the friction coefficient. It applies only to gestures in the scrolling area, and * it affects only indirectly the scroll chaining during the inertial scrolling process. * If this attribute is set to a value less than or equal to 0, the default value is used. * * @param { number | Resource } value - Friction coefficient. *
Default value: 0.9 for wearable devices and 0.6 for non-wearable devices *
Since API version 11, the default value for non-wearable devices is 0.7. *
Since API version 12, the default value for non-wearable devices is 0.75. * @returns { ScrollAttribute } the attribute of the scroll. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ friction(value: number | Resource): ScrollAttribute; /** * Called to setting the scroll snap options. * * @param { ScrollSnapOptions } value - options for scroll snap. * @returns { ScrollAttribute } the attribute of the scroll. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Sets the scroll snapping mode. * * @param { ScrollSnapOptions } value - Scroll snapping mode. * @returns { ScrollAttribute } the attribute of the scroll. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ scrollSnap(value: ScrollSnapOptions): ScrollAttribute; /** * Determines whether the scroll view stops on multiples of the content size when the user scrolls. * * @param { boolean } value - A boolean value determines whether paging is enabled for scroll. * @returns { ScrollAttribute } the attribute of the scroll. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * Sets whether to enable the swipe-to-turn-pages feature. * * @param { boolean } value - Whether to enable the swipe-to-turn-pages feature. Default value: false. * The value true means to enable the swipe-to-turn-pages feature, and false means the opposite. * @returns { ScrollAttribute } the attribute of the scroll. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ enablePaging(value: boolean): ScrollAttribute; /** * Sets the initial scrolling offset. * * @param { OffsetOptions } value - Initial scrolling offset. When the value specified is a percentage, * the initial scrolling offset is calculated as the product of the Scroll component's size * in the main axis direction and the percentage value. * @returns { ScrollAttribute } the attribute of the scroll. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ initialOffset(value: OffsetOptions): ScrollAttribute; } /** * Represents the callback triggered when the Scroll component scrolls. * *

NOTE *
If the onScrollFrameBegin event and scrollBy method are used to implement nested scrolling, * set the edgeEffect attribute of the scrollable child component to None. For example, * if a List is nested in the Scroll component, edgeEffect of the List must be set to EdgeEffect.None. *

* * @typedef { function } ScrollOnScrollCallback * @param { number } xOffset - Horizontal offset per frame during scrolling. A positive offset indicates scrolling to the left, * and a negative offset indicates scrolling to the right. *
Unit: vp * @param { number } yOffset - Vertical offset per frame during scrolling. * A positive offset indicates scrolling upward, and a negative offset indicates scrolling downward. *
Unit: vp * @param { ScrollState } scrollState - Current scrolling state. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ declare type ScrollOnScrollCallback = (xOffset: number, yOffset: number, scrollState: ScrollState) => void; /** * Called before scroll to allow developer to control real offset the Scroll can scroll. * * @typedef { function } ScrollOnWillScrollCallback * @param { number } xOffset - Horizontal offset per frame during scrolling. * A positive offset indicates scrolling to the left, and a negative offset indicates scrolling to the right. *
Unit: vp * @param { number } yOffset - offset per frame during scrolling. * A positive offset indicates scrolling upward, and a negative offset indicates scrolling downward. *
Unit: vp * @param { ScrollState } scrollState - Current scrolling state. * @param { ScrollSource } scrollSource - Source of the current scrolling operation. * @returns { void | OffsetResult } the remain offset for the Scroll, * same as (xOffset, yOffset) when no OffsetResult is returned. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ declare type ScrollOnWillScrollCallback = (xOffset: number, yOffset: number, scrollState: ScrollState, scrollSource: ScrollSource) => void | OffsetResult; /** * Called before scroll to allow developer to control real offset the Scroll can scroll. * * @typedef { function } ScrollOnWillScrollCallback * @param { number } xOffset - horizontal offset this frame will scroll, which may or may not be reached. * @param { number } yOffset - vertical offset this frame will scroll, which may or may not be reached. * @param { ScrollState } scrollState - current scroll state. * @param { ScrollSource } scrollSource - source of current scroll. * @returns { undefined | OffsetResult } the remain offset for the Scroll, * same as (xOffset, yOffset) when no OffsetResult is returned. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ declare type ScrollOnWillScrollCallback = (xOffset: number, yOffset: number, scrollState: ScrollState, scrollSource: ScrollSource) => undefined | OffsetResult; /** * callback of Scroll, using in onDidZoom. * * @typedef { function } ScrollOnDidZoomCallback * @param { number } scale - current zoom scale. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 */ declare type ScrollOnDidZoomCallback = (scale: number) => void; /** * Defines Scroll Component. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Defines Scroll Component. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Defines Scroll Component. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 11 */ declare const Scroll: ScrollInterface; /** * Defines Scroll Component instance. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Defines Scroll Component instance. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Defines Scroll Component instance. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 11 */ declare const ScrollInstance: ScrollAttribute;