-
Notifications
You must be signed in to change notification settings - Fork 3.1k
/
Copy pathReportHeaderSkeletonView.tsx
74 lines (69 loc) · 2.66 KB
/
ReportHeaderSkeletonView.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import React from 'react';
import {View} from 'react-native';
import {Circle, Rect} from 'react-native-svg';
import useLocalize from '@hooks/useLocalize';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import useWindowDimensions from '@hooks/useWindowDimensions';
import variables from '@styles/variables';
import CONST from '@src/CONST';
import Icon from './Icon';
import * as Expensicons from './Icon/Expensicons';
import PressableWithFeedback from './Pressable/PressableWithFeedback';
import SkeletonViewContentLoader from './SkeletonViewContentLoader';
type ReportHeaderSkeletonViewProps = {
shouldAnimate?: boolean;
onBackButtonPress?: () => void;
};
function ReportHeaderSkeletonView({shouldAnimate = true, onBackButtonPress = () => {}}: ReportHeaderSkeletonViewProps) {
const theme = useTheme();
const styles = useThemeStyles();
const {translate} = useLocalize();
const {isSmallScreenWidth} = useWindowDimensions();
return (
<View style={[styles.appContentHeader]}>
<View style={[styles.appContentHeaderTitle, !isSmallScreenWidth && styles.pl5]}>
{isSmallScreenWidth && (
<PressableWithFeedback
onPress={onBackButtonPress}
style={[styles.LHNToggle]}
role={CONST.ROLE.BUTTON}
accessibilityLabel={translate('common.back')}
>
<Icon
fill={theme.icon}
src={Expensicons.BackArrow}
/>
</PressableWithFeedback>
)}
<SkeletonViewContentLoader
animate={shouldAnimate}
width={styles.w100.width}
height={variables.contentHeaderHeight}
backgroundColor={theme.highlightBG}
foregroundColor={theme.border}
>
<Circle
cx="20"
cy="33"
r="20"
/>
<Rect
x="55"
y="20"
width="30%"
height="8"
/>
<Rect
x="55"
y="40"
width="40%"
height="8"
/>
</SkeletonViewContentLoader>
</View>
</View>
);
}
ReportHeaderSkeletonView.displayName = 'ReportHeaderSkeletonView';
export default ReportHeaderSkeletonView;