-
Notifications
You must be signed in to change notification settings - Fork 3k
/
Copy pathSkeletonViewLines.js
68 lines (64 loc) · 1.86 KB
/
SkeletonViewLines.js
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
import React from 'react';
import PropTypes from 'prop-types';
import {Rect, Circle} from 'react-native-svg';
import SkeletonViewContentLoader from 'react-content-loader/native';
import CONST from '../../CONST';
import themeColors from '../../styles/themes/default';
import styles from '../../styles/styles';
const propTypes = {
/** Number of rows to show in Skeleton UI block */
numberOfRows: PropTypes.number.isRequired,
shouldAnimate: PropTypes.bool,
};
const defaultTypes = {
shouldAnimate: true,
};
function SkeletonViewLines(props) {
return (
<SkeletonViewContentLoader
animate={props.shouldAnimate}
height={CONST.CHAT_SKELETON_VIEW.HEIGHT_FOR_ROW_COUNT[props.numberOfRows]}
backgroundColor={themeColors.highlightBG}
foregroundColor={themeColors.border}
style={styles.mr5}
>
<Circle
cx="40"
cy="26"
r="20"
/>
<Rect
x="67"
y="11"
width="20%"
height="8"
/>
<Rect
x="67"
y="31"
width="100%"
height="8"
/>
{props.numberOfRows > 1 && (
<Rect
x="67"
y="51"
width="50%"
height="8"
/>
)}
{props.numberOfRows > 2 && (
<Rect
x="67"
y="71"
width="50%"
height="8"
/>
)}
</SkeletonViewContentLoader>
);
}
SkeletonViewLines.displayName = 'SkeletonViewLines';
SkeletonViewLines.propTypes = propTypes;
SkeletonViewLines.defaultProps = defaultTypes;
export default SkeletonViewLines;