-
Notifications
You must be signed in to change notification settings - Fork 2.6k
/
SkeletonViewLines.tsx
63 lines (60 loc) · 1.77 KB
/
SkeletonViewLines.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
import React from 'react';
import {Circle, Rect} from 'react-native-svg';
import SkeletonViewContentLoader from '@components/SkeletonViewContentLoader';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import CONST from '@src/CONST';
type SkeletonViewLinesProps = {
/** Number of rows to show in Skeleton UI block */
numberOfRows: 1 | 2 | 3;
shouldAnimate?: boolean;
};
function SkeletonViewLines({numberOfRows, shouldAnimate = true}: SkeletonViewLinesProps) {
const theme = useTheme();
const styles = useThemeStyles();
return (
<SkeletonViewContentLoader
animate={shouldAnimate}
height={CONST.CHAT_SKELETON_VIEW.HEIGHT_FOR_ROW_COUNT[numberOfRows]}
backgroundColor={theme.skeletonLHNIn}
foregroundColor={theme.skeletonLHNOut}
style={styles.mr5}
>
<Circle
cx="40"
cy="26"
r="20"
/>
<Rect
x="72"
y="11"
width="20%"
height="8"
/>
<Rect
x="72"
y="31"
width="100%"
height="8"
/>
{numberOfRows > 1 && (
<Rect
x="72"
y="51"
width="50%"
height="8"
/>
)}
{numberOfRows > 2 && (
<Rect
x="72"
y="71"
width="50%"
height="8"
/>
)}
</SkeletonViewContentLoader>
);
}
SkeletonViewLines.displayName = 'SkeletonViewLines';
export default SkeletonViewLines;