Skip to content

Commit 8e5a72e

Browse files
Chandrasekar-Gchinesedfan
authored andcommitted
refactor(styled-components): migrate LoadingMembersList (#838)
1 parent 73e5be6 commit 8e5a72e

File tree

1 file changed

+32
-30
lines changed

1 file changed

+32
-30
lines changed
Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
11
import React, { Component } from 'react';
2-
import { StyleSheet, View, Text, Animated } from 'react-native';
2+
import { Animated } from 'react-native';
3+
import styled from 'styled-components';
34

45
import { colors, fonts } from 'config';
56
import { loadingAnimation } from 'utils';
67

7-
const styles = StyleSheet.create({
8-
wrapper: {
9-
marginTop: 15,
10-
padding: 15,
11-
},
12-
avatarContainer: {
13-
flex: 1,
14-
flexDirection: 'row',
15-
},
16-
avatar: {
17-
borderRadius: 15,
18-
height: 30,
19-
width: 30,
20-
backgroundColor: colors.grey,
21-
marginRight: 5,
22-
},
23-
sectionTitle: {
24-
color: colors.black,
25-
...fonts.fontPrimaryBold,
26-
marginBottom: 10,
27-
},
28-
});
8+
const Wrapper = styled.View`
9+
margin-top: 15;
10+
padding: 15px;
11+
`;
12+
13+
const SectionTitle = styled.Text`
14+
color: ${colors.black};
15+
margin-bottom: 10;
16+
${fonts.fontPrimaryBold};
17+
`;
18+
19+
const AvatarContainer = styled.View`
20+
flex: 1;
21+
flex-direction: row;
22+
`;
23+
24+
const Avatar = styled(Animated.View)`
25+
border-radius: 15;
26+
height: 30;
27+
width: 30;
28+
background-color: ${colors.grey};
29+
margin-right: 5;
30+
`;
2931

3032
export class LoadingMembersList extends Component {
3133
props: {
@@ -47,20 +49,20 @@ export class LoadingMembersList extends Component {
4749
const { title } = this.props;
4850

4951
return (
50-
<View style={styles.wrapper}>
51-
<Text style={styles.sectionTitle}>{title}</Text>
52+
<Wrapper>
53+
<SectionTitle>{title}</SectionTitle>
5254

53-
<View style={styles.avatarContainer}>
55+
<AvatarContainer>
5456
{[...Array(10)].map((item, index) => {
5557
return (
56-
<Animated.View
58+
<Avatar
5759
key={index} // eslint-disable-line react/no-array-index-key
58-
style={[styles.avatar, { opacity: this.state.fadeAnimValue }]}
60+
style={{ opacity: this.state.fadeAnimValue }}
5961
/>
6062
);
6163
})}
62-
</View>
63-
</View>
64+
</AvatarContainer>
65+
</Wrapper>
6466
);
6567
}
6668
}

0 commit comments

Comments
 (0)