-
Notifications
You must be signed in to change notification settings - Fork 2.8k
/
index.tsx
58 lines (53 loc) · 2.09 KB
/
index.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
import React from 'react';
import {View} from 'react-native';
import {Circle, Rect} from 'react-native-svg';
import type {ValueOf} from 'type-fest';
import SkeletonViewContentLoader from '@components/SkeletonViewContentLoader';
import useStyleUtils from '@hooks/useStyleUtils';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import CONST from '@src/CONST';
type AccountSwitcherSkeletonViewProps = {
/** Whether to animate the skeleton view */
shouldAnimate?: boolean;
/** The size of the avatar */
avatarSize?: ValueOf<typeof CONST.AVATAR_SIZE>;
};
function AccountSwitcherSkeletonView({shouldAnimate = true, avatarSize = CONST.AVATAR_SIZE.DEFAULT}: AccountSwitcherSkeletonViewProps) {
const theme = useTheme();
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
const avatarPlaceholderSize = StyleUtils.getAvatarSize(avatarSize);
const avatarPlaceholderRadius = avatarPlaceholderSize / 2;
const startPositionX = 30;
return (
<View style={styles.avatarSectionWrapperSkeleton}>
<SkeletonViewContentLoader
animate={shouldAnimate}
backgroundColor={theme.skeletonLHNIn}
foregroundColor={theme.skeletonLHNOut}
height={avatarPlaceholderSize}
>
<Circle
cx={startPositionX}
cy={avatarPlaceholderRadius}
r={avatarPlaceholderRadius}
/>
<Rect
x={startPositionX + avatarPlaceholderRadius + styles.gap3.gap}
y="6"
width="45%"
height="8"
/>
<Rect
x={startPositionX + avatarPlaceholderRadius + styles.gap3.gap}
y="26"
width="55%"
height="8"
/>
</SkeletonViewContentLoader>
</View>
);
}
AccountSwitcherSkeletonView.displayName = 'AccountSwitcherSkeletonView';
export default AccountSwitcherSkeletonView;