mattermost-mobile/app/components/post_list/refresh_control.tsx
Elias Nahum 784b05fe97
Upgrade Dependencies (#7299)
* upgrade reanimated

* update devDependencies

* upgrade react-intl

* update react-native and some dependencies

* update react-native-permissions

* update RN

* use Share sheet for Report a problem

* update Sentry

* remove step to downloadWebRTC

* update detox deps

* feedback review
2023-04-21 12:16:54 -04:00

41 lines
1,011 B
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React from 'react';
import {Platform, RefreshControl, type StyleProp, type ViewStyle} from 'react-native';
type Props = {
children: React.ReactElement;
enabled: boolean;
onRefresh: () => void;
refreshing: boolean;
style?: StyleProp<ViewStyle>;
}
const PostListRefreshControl = ({children, enabled, onRefresh, refreshing, style}: Props) => {
const props = {
onRefresh,
refreshing,
};
if (Platform.OS === 'android') {
return (
<RefreshControl
{...props}
enabled={enabled}
style={style}
>
{children}
</RefreshControl>
);
}
const refreshControl = <RefreshControl {...props}/>;
return React.cloneElement(
children,
{refreshControl, inverted: true},
);
};
export default PostListRefreshControl;