2019-01-18 13:16:59 +03:00
|
|
|
/**
|
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
|
|
|
*
|
|
|
|
* @format
|
2019-12-06 02:58:55 +03:00
|
|
|
* @flow strict-local
|
2019-01-18 13:16:59 +03:00
|
|
|
*/
|
|
|
|
|
2019-11-13 21:19:02 +03:00
|
|
|
import * as React from 'react';
|
|
|
|
|
|
|
|
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
|
2019-06-20 23:58:15 +03:00
|
|
|
import codegenNativeComponent from '../../Utilities/codegenNativeComponent';
|
2019-09-25 21:42:07 +03:00
|
|
|
import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
|
2019-01-18 13:16:59 +03:00
|
|
|
|
2019-06-20 23:58:15 +03:00
|
|
|
import type {
|
2019-07-01 15:10:20 +03:00
|
|
|
DirectEventHandler,
|
2019-06-20 23:58:15 +03:00
|
|
|
Float,
|
|
|
|
WithDefault,
|
|
|
|
} from '../../Types/CodegenTypes';
|
2020-04-17 23:01:17 +03:00
|
|
|
import type {ColorValue} from '../../StyleSheet/StyleSheet';
|
2019-05-08 18:44:25 +03:00
|
|
|
import type {ViewProps} from '../View/ViewPropTypes';
|
2019-01-18 13:16:59 +03:00
|
|
|
|
|
|
|
type NativeProps = $ReadOnly<{|
|
|
|
|
...ViewProps,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether the pull to refresh functionality is enabled.
|
|
|
|
*/
|
2019-09-23 17:15:16 +03:00
|
|
|
enabled?: WithDefault<boolean, true>,
|
2019-01-18 13:16:59 +03:00
|
|
|
/**
|
|
|
|
* The colors (at least one) that will be used to draw the refresh indicator.
|
|
|
|
*/
|
|
|
|
colors?: ?$ReadOnlyArray<ColorValue>,
|
|
|
|
/**
|
|
|
|
* The background color of the refresh indicator.
|
|
|
|
*/
|
|
|
|
progressBackgroundColor?: ?ColorValue,
|
|
|
|
/**
|
2021-01-26 08:03:27 +03:00
|
|
|
* Size of the refresh indicator.
|
2019-01-18 13:16:59 +03:00
|
|
|
*/
|
2021-01-17 13:53:58 +03:00
|
|
|
size?: WithDefault<'default' | 'large', 'default'>,
|
2019-01-18 13:16:59 +03:00
|
|
|
/**
|
|
|
|
* Progress view top offset
|
|
|
|
*/
|
2019-07-02 12:59:04 +03:00
|
|
|
progressViewOffset?: WithDefault<Float, 0>,
|
2019-01-18 13:16:59 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when the view starts refreshing.
|
|
|
|
*/
|
2019-07-01 15:10:20 +03:00
|
|
|
onRefresh?: ?DirectEventHandler<null>,
|
2019-01-18 13:16:59 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether the view should be indicating an active refresh.
|
|
|
|
*/
|
2019-07-01 17:47:58 +03:00
|
|
|
refreshing: boolean,
|
2019-01-18 13:16:59 +03:00
|
|
|
|}>;
|
|
|
|
|
2019-11-13 21:19:02 +03:00
|
|
|
type NativeType = HostComponent<NativeProps>;
|
|
|
|
|
|
|
|
interface NativeCommands {
|
|
|
|
+setNativeRefreshing: (
|
|
|
|
viewRef: React.ElementRef<NativeType>,
|
|
|
|
value: boolean,
|
|
|
|
) => void;
|
|
|
|
}
|
|
|
|
|
|
|
|
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
|
|
|
|
supportedCommands: ['setNativeRefreshing'],
|
|
|
|
});
|
|
|
|
|
2019-08-09 20:06:53 +03:00
|
|
|
export default (codegenNativeComponent<NativeProps>(
|
|
|
|
'AndroidSwipeRefreshLayout',
|
2019-11-13 21:19:02 +03:00
|
|
|
): NativeType);
|