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