Rocket.Chat.ReactNative/app/containers/message/Components/BlurComponent/index.tsx

38 lines
1.0 KiB
TypeScript
Raw Normal View History

2023-07-03 22:15:58 +00:00
import React from 'react';
import { StyleProp, View, ViewStyle } from 'react-native';
import { BlurView } from '@react-native-community/blur';
import styles from '../../styles';
import { useTheme } from '../../../../theme';
import RCActivityIndicator from '../../../ActivityIndicator';
import { CustomIcon, TIconsName } from '../../../CustomIcon';
const BlurComponent = ({
loading = false,
style = {},
2023-07-04 03:35:31 +00:00
iconName,
showOverlay = false
2023-07-03 22:15:58 +00:00
}: {
loading: boolean;
style: StyleProp<ViewStyle>;
iconName: TIconsName;
showOverlay?: boolean;
2023-07-03 22:15:58 +00:00
}) => {
2023-07-04 03:35:31 +00:00
const { colors } = useTheme();
2023-07-03 22:15:58 +00:00
return (
<>
{!showOverlay ? (
<BlurView style={[style, styles.blurView]} blurType={'dark'} blurAmount={2} />
) : (
<View style={[style, styles.blurView, { backgroundColor: colors.overlayColor }]} />
)}
2023-07-03 22:15:58 +00:00
<View style={[style, styles.blurIndicator]}>
2023-07-04 03:35:31 +00:00
{loading ? <RCActivityIndicator size={54} /> : <CustomIcon color={colors.buttonText} name={iconName} size={54} />}
2023-07-03 22:15:58 +00:00
</View>
</>
);
};
export default BlurComponent;