1*fe5cfb17STomasz Sapeta/** 2*fe5cfb17STomasz Sapeta * Copyright (c) Meta Platforms, Inc. and affiliates. 3*fe5cfb17STomasz Sapeta * 4*fe5cfb17STomasz Sapeta * This source code is licensed under the MIT license found in the 5*fe5cfb17STomasz Sapeta * LICENSE file in the root directory of this source tree. 6*fe5cfb17STomasz Sapeta * 7*fe5cfb17STomasz Sapeta * @format 8*fe5cfb17STomasz Sapeta */ 9*fe5cfb17STomasz Sapeta 10*fe5cfb17STomasz Sapetaimport type * as React from 'react'; 11*fe5cfb17STomasz Sapetaimport {Constructor} from '../../../types/private/Utilities'; 12*fe5cfb17STomasz Sapetaimport {NativeMethods} from '../../../types/public/ReactNativeTypes'; 13*fe5cfb17STomasz Sapetaimport {ColorValue} from '../../StyleSheet/StyleSheet'; 14*fe5cfb17STomasz Sapetaimport {ViewProps} from '../View/ViewPropTypes'; 15*fe5cfb17STomasz Sapeta 16*fe5cfb17STomasz Sapetaexport interface RefreshControlPropsIOS extends ViewProps { 17*fe5cfb17STomasz Sapeta /** 18*fe5cfb17STomasz Sapeta * The color of the refresh indicator. 19*fe5cfb17STomasz Sapeta */ 20*fe5cfb17STomasz Sapeta tintColor?: ColorValue | undefined; 21*fe5cfb17STomasz Sapeta 22*fe5cfb17STomasz Sapeta /** 23*fe5cfb17STomasz Sapeta * The title displayed under the refresh indicator. 24*fe5cfb17STomasz Sapeta */ 25*fe5cfb17STomasz Sapeta title?: string | undefined; 26*fe5cfb17STomasz Sapeta 27*fe5cfb17STomasz Sapeta /** 28*fe5cfb17STomasz Sapeta * Title color. 29*fe5cfb17STomasz Sapeta */ 30*fe5cfb17STomasz Sapeta titleColor?: ColorValue | undefined; 31*fe5cfb17STomasz Sapeta} 32*fe5cfb17STomasz Sapeta 33*fe5cfb17STomasz Sapetaexport interface RefreshControlPropsAndroid extends ViewProps { 34*fe5cfb17STomasz Sapeta /** 35*fe5cfb17STomasz Sapeta * The colors (at least one) that will be used to draw the refresh indicator. 36*fe5cfb17STomasz Sapeta */ 37*fe5cfb17STomasz Sapeta colors?: ColorValue[] | undefined; 38*fe5cfb17STomasz Sapeta 39*fe5cfb17STomasz Sapeta /** 40*fe5cfb17STomasz Sapeta * Whether the pull to refresh functionality is enabled. 41*fe5cfb17STomasz Sapeta */ 42*fe5cfb17STomasz Sapeta enabled?: boolean | undefined; 43*fe5cfb17STomasz Sapeta 44*fe5cfb17STomasz Sapeta /** 45*fe5cfb17STomasz Sapeta * The background color of the refresh indicator. 46*fe5cfb17STomasz Sapeta */ 47*fe5cfb17STomasz Sapeta progressBackgroundColor?: ColorValue | undefined; 48*fe5cfb17STomasz Sapeta 49*fe5cfb17STomasz Sapeta /** 50*fe5cfb17STomasz Sapeta * Size of the refresh indicator, see RefreshControl.SIZE. 51*fe5cfb17STomasz Sapeta */ 52*fe5cfb17STomasz Sapeta size?: number | undefined; 53*fe5cfb17STomasz Sapeta} 54*fe5cfb17STomasz Sapeta 55*fe5cfb17STomasz Sapetaexport interface RefreshControlProps 56*fe5cfb17STomasz Sapeta extends RefreshControlPropsIOS, 57*fe5cfb17STomasz Sapeta RefreshControlPropsAndroid { 58*fe5cfb17STomasz Sapeta /** 59*fe5cfb17STomasz Sapeta * Called when the view starts refreshing. 60*fe5cfb17STomasz Sapeta */ 61*fe5cfb17STomasz Sapeta onRefresh?: (() => void) | undefined; 62*fe5cfb17STomasz Sapeta 63*fe5cfb17STomasz Sapeta /** 64*fe5cfb17STomasz Sapeta * Whether the view should be indicating an active refresh. 65*fe5cfb17STomasz Sapeta */ 66*fe5cfb17STomasz Sapeta refreshing: boolean; 67*fe5cfb17STomasz Sapeta 68*fe5cfb17STomasz Sapeta /** 69*fe5cfb17STomasz Sapeta * Progress view top offset 70*fe5cfb17STomasz Sapeta */ 71*fe5cfb17STomasz Sapeta progressViewOffset?: number | undefined; 72*fe5cfb17STomasz Sapeta} 73*fe5cfb17STomasz Sapeta 74*fe5cfb17STomasz Sapeta/** 75*fe5cfb17STomasz Sapeta * This component is used inside a ScrollView or ListView to add pull to refresh 76*fe5cfb17STomasz Sapeta * functionality. When the ScrollView is at `scrollY: 0`, swiping down 77*fe5cfb17STomasz Sapeta * triggers an `onRefresh` event. 78*fe5cfb17STomasz Sapeta * 79*fe5cfb17STomasz Sapeta * __Note:__ `refreshing` is a controlled prop, this is why it needs to be set to true 80*fe5cfb17STomasz Sapeta * in the `onRefresh` function otherwise the refresh indicator will stop immediately. 81*fe5cfb17STomasz Sapeta */ 82*fe5cfb17STomasz Sapetadeclare class RefreshControlComponent extends React.Component<RefreshControlProps> {} 83*fe5cfb17STomasz Sapetadeclare const RefreshControlBase: Constructor<NativeMethods> & 84*fe5cfb17STomasz Sapeta typeof RefreshControlComponent; 85*fe5cfb17STomasz Sapetaexport class RefreshControl extends RefreshControlBase { 86*fe5cfb17STomasz Sapeta static SIZE: Object; // Undocumented 87*fe5cfb17STomasz Sapeta} 88