• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import {CommonMethod, Edge, Axis, Curve, BarState, EdgeEffect, Color} from "./common";
17
18export declare enum ScrollDirection {
19  Vertical,
20  Horizontal,
21  Free,
22  None
23}
24
25export declare class Scroller {
26  constructor();
27
28  scrollTo(value: { xOffset: number | string, yOffset: number | string,
29    animation?: { duration: number, curve: Curve } });
30
31  scrollEdge(value: Edge);
32
33  scrollPage(value: { next: boolean, direction?: Axis });
34
35  currentOffset();
36
37  scrollToIndex(value: number);
38}
39
40export declare class ScrollExtend<T> extends ScrollAttribute<T> {
41}
42
43interface Scroll extends ScrollAttribute<Scroll> {
44  (scroller?: Scroller): Scroll;
45}
46
47declare class ScrollAttribute<T> extends CommonMethod<T> {
48  scrollable(value: ScrollDirection): T;
49
50  onScroll(event: (xOffset: number, yOffset: number) => void): T;
51
52  onScrollEdge(event: (side: Edge) => void): T;
53
54  onScrollEnd(event: () => void): T;
55
56  scrollBar(barState: BarState): T;
57
58  scrollBarColor(color: Color | number | string): T;
59
60  scrollBarWidth(value: number | string): T;
61
62  edgeEffect(edgeEffect: EdgeEffect): T;
63}
64
65export declare const ScrollInterface: Scroll;
66