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 16/** 17 * The refresh status of the drop-down refresh. 18 * @since 8 19 */ 20declare enum RefreshStatus { 21 /** 22 * The refresh status of the drop-down refresh. 23 * @since 8 24 */ 25 Inactive, 26 27 /** 28 * Drop down, but the drop-down distance is less than the refresh distance. 29 * @since 8 30 */ 31 Drag, 32 33 /** 34 * The pull-down exceeds the refresh distance. 35 * @since 8 36 */ 37 OverDrag, 38 39 /** 40 * After the pull-down, it rebounds to the refresh distance and enters the refresh state. 41 * @since 8 42 */ 43 Refresh, 44 45 /** 46 * After refresh, return to the initial state. 47 * @since 8 48 */ 49 Done, 50} 51 52/** 53 * Provides a pull-down refresh interface. 54 * @since 8 55 */ 56interface RefreshInterface { 57 /** 58 * Called when the drop-down refresh is set. 59 * @since 8 60 */ 61 (value: { refreshing: boolean; offset?: number | string; friction?: number | string }): RefreshAttribute; 62} 63 64/** 65 * Defines the refresh attribute functions. 66 * @since 8 67 */ 68declare class RefreshAttribute extends CommonMethod<RefreshAttribute> { 69 /** 70 * Called when the refresh state changes. 71 * @since 8 72 */ 73 onStateChange(callback: (state: RefreshStatus) => void): RefreshAttribute; 74 75 /** 76 * Called when the refresh state is entered. 77 * @since 8 78 */ 79 onRefreshing(callback: () => void): RefreshAttribute; 80} 81 82/** 83 * Defines Refresh Component. 84 * @since 8 85 */ 86declare const Refresh: RefreshInterface; 87 88/** 89 * Defines Refresh Component instance. 90 * @since 8 91 */ 92declare const RefreshInstance: RefreshAttribute; 93