Skip to content

Commit e7f9bc0

Browse files
committed
Update TweetBig.js
moving styles out of constructor
1 parent 824ad91 commit e7f9bc0

File tree

1 file changed

+61
-65
lines changed

1 file changed

+61
-65
lines changed

twitter-example/components/TweetBig.js

Lines changed: 61 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -5,71 +5,6 @@ const propTypes = {
55
};
66

77
class TweetBig extends React.Component {
8-
constructor(props) {
9-
super(props);
10-
this.styles = StyleSheet.create({
11-
retweetContainer: {
12-
margin: 10,
13-
paddingTop: 8,
14-
flexDirection: 'row',
15-
borderTopWidth: 1,
16-
borderColor: '#DAE6F0',
17-
},
18-
rtBold: {
19-
fontSize: 14,
20-
marginRight: 3,
21-
fontWeight: '600',
22-
},
23-
rtText: {
24-
fontSize: 14,
25-
fontWeight: '400',
26-
color: '#748999',
27-
},
28-
29-
tweetContainer: {
30-
backgroundColor: 'white',
31-
borderBottomWidth: 1,
32-
borderColor: '#DAE6F0',
33-
paddingTop: 4,
34-
},
35-
avatar: {
36-
backgroundColor: 'gray',
37-
width: 50,
38-
height: 50,
39-
marginLeft: 10,
40-
borderRadius: 4,
41-
},
42-
userContainer: {
43-
flexDirection: 'row',
44-
alignItems: 'center',
45-
flex: 1,
46-
},
47-
textContainer: {
48-
flex: 1,
49-
padding: 10,
50-
flexDirection: 'column',
51-
},
52-
username: {
53-
fontSize: 13,
54-
color: '#8999a5',
55-
marginTop: 2,
56-
},
57-
name: {
58-
fontWeight: '600',
59-
fontSize: 15,
60-
},
61-
text: {
62-
marginTop: 5,
63-
fontSize: 17,
64-
fontWeight: '300',
65-
},
66-
rightContainer: {
67-
flex: 1,
68-
padding: 10,
69-
},
70-
});
71-
}
72-
738
render() {
749
const {
7510
text,
@@ -99,6 +34,67 @@ class TweetBig extends React.Component {
9934
}
10035
}
10136

37+
const styles = StyleSheet.create({
38+
retweetContainer: {
39+
margin: 10,
40+
paddingTop: 8,
41+
flexDirection: 'row',
42+
borderTopWidth: 1,
43+
borderColor: '#DAE6F0',
44+
},
45+
rtBold: {
46+
fontSize: 14,
47+
marginRight: 3,
48+
fontWeight: '600',
49+
},
50+
rtText: {
51+
fontSize: 14,
52+
fontWeight: '400',
53+
color: '#748999',
54+
},
55+
tweetContainer: {
56+
backgroundColor: 'white',
57+
borderBottomWidth: 1,
58+
borderColor: '#DAE6F0',
59+
paddingTop: 4,
60+
},
61+
avatar: {
62+
backgroundColor: 'gray',
63+
width: 50,
64+
height: 50,
65+
marginLeft: 10,
66+
borderRadius: 4,
67+
},
68+
userContainer: {
69+
flexDirection: 'row',
70+
alignItems: 'center',
71+
flex: 1,
72+
},
73+
textContainer: {
74+
flex: 1,
75+
padding: 10,
76+
flexDirection: 'column',
77+
},
78+
username: {
79+
fontSize: 13,
80+
color: '#8999a5',
81+
marginTop: 2,
82+
},
83+
name: {
84+
fontWeight: '600',
85+
fontSize: 15,
86+
},
87+
text: {
88+
marginTop: 5,
89+
fontSize: 17,
90+
fontWeight: '300',
91+
},
92+
rightContainer: {
93+
flex: 1,
94+
padding: 10,
95+
},
96+
});
97+
10298
TweetBig.propTypes = propTypes;
10399

104100
export default TweetBig;

0 commit comments

Comments
 (0)