@@ -77,62 +77,14 @@ export default class HotPanel extends Component{
77
77
key = { index }
78
78
onPress = { this . _hotPanelCallback . bind ( this , item ) }
79
79
activeOpacity = { theme . btnActiveOpacity } >
80
- < View >
81
- < View style = { styles . listItem } >
82
- < View style = { { flex : 80 , marginTop : px2dp ( 10 ) } } >
83
- < Text style = { styles . content } numberOfLines = { 2 } > { item . title } </ Text >
84
- < View style = { styles . infoBar } >
85
- < Icon name = "heart" size = { px2dp ( 13 ) } color = { theme . grayColor } />
86
- < Text style = { styles . infoBarText } > { item . collectionCount } </ Text >
87
- < Icon name = "person" size = { px2dp ( 12 ) } color = { theme . grayColor } />
88
- < Text style = { styles . infoBarText } > { item . user . username } </ Text >
89
- < Icon name = "clock" size = { px2dp ( 13 ) } color = { theme . grayColor } />
90
- < Text style = { styles . infoBarText } > { item . time } </ Text >
91
- </ View >
92
- </ View >
93
- < View style = { { flex : 20 , flexDirection : 'row' , justifyContent : 'flex-end' , alignItems : 'center' } } >
94
- { item . screenshot ?
95
- < Image source = { { uri : item . screenshot . url } }
96
- style = { styles . image } />
97
- :
98
- < Image source = { require ( '../image/user_article_no_data.png' ) }
99
- style = { styles . image } />
100
- }
101
- </ View >
102
- </ View >
103
- < View style = { { height : 1 / PixelRatio . get ( ) , backgroundColor : '#f1f1f1' } } > </ View >
104
- </ View >
80
+ { this . _renderContent ( item , index ) }
105
81
</ TouchableOpacity >
106
82
) } else if ( Platform . OS === 'android' ) {
107
83
return (
108
84
< TouchableNativeFeedback
109
85
key = { index }
110
86
onPress = { this . _hotPanelCallback . bind ( this , item ) } >
111
- < View >
112
- < View style = { styles . listItem } >
113
- < View style = { { flex : 80 , marginTop : px2dp ( 10 ) } } >
114
- < Text style = { styles . content } numberOfLines = { 2 } > { item . title } </ Text >
115
- < View style = { styles . infoBar } >
116
- < Icon name = "heart" size = { px2dp ( 13 ) } color = { theme . grayColor } />
117
- < Text style = { styles . infoBarText } > { item . collectionCount } </ Text >
118
- < Icon name = "person" size = { px2dp ( 12 ) } color = { theme . grayColor } />
119
- < Text style = { styles . infoBarText } > { item . user . username } </ Text >
120
- < Icon name = "clock" size = { px2dp ( 13 ) } color = { theme . grayColor } />
121
- < Text style = { styles . infoBarText } > { item . time } </ Text >
122
- </ View >
123
- </ View >
124
- < View style = { { flex : 20 , flexDirection : 'row' , justifyContent : 'flex-end' , alignItems : 'center' } } >
125
- { item . screenshot ?
126
- < Image source = { { uri : item . screenshot . url } }
127
- style = { styles . image } />
128
- :
129
- < Image source = { require ( '../image/user_article_no_data.png' ) }
130
- style = { styles . image } />
131
- }
132
- </ View >
133
- </ View >
134
- < View style = { { height : 1 / PixelRatio . get ( ) , backgroundColor : '#f1f1f1' } } > </ View >
135
- </ View >
87
+ { this . _renderContent ( item , index ) }
136
88
</ TouchableNativeFeedback >
137
89
) } } )
138
90
}
@@ -144,6 +96,36 @@ export default class HotPanel extends Component{
144
96
}
145
97
}
146
98
99
+ _renderContent ( item , index ) {
100
+ return (
101
+ < View >
102
+ < View style = { styles . listItem } >
103
+ < View style = { { flex : 80 , marginTop : px2dp ( 10 ) } } >
104
+ < Text style = { styles . content } numberOfLines = { 2 } > { item . title } </ Text >
105
+ < View style = { styles . infoBar } >
106
+ < Icon name = "heart" size = { px2dp ( 13 ) } color = { theme . grayColor } />
107
+ < Text style = { styles . infoBarText } > { item . collectionCount } </ Text >
108
+ < Icon name = "person" size = { px2dp ( 12 ) } color = { theme . grayColor } />
109
+ < Text style = { styles . infoBarText } > { item . user . username } </ Text >
110
+ < Icon name = "clock" size = { px2dp ( 13 ) } color = { theme . grayColor } />
111
+ < Text style = { styles . infoBarText } > { item . time } </ Text >
112
+ </ View >
113
+ </ View >
114
+ < View style = { { flex : 20 , flexDirection : 'row' , justifyContent : 'flex-end' , alignItems : 'center' } } >
115
+ { item . screenshot ?
116
+ < Image source = { { uri : item . screenshot . url } }
117
+ style = { styles . image } />
118
+ :
119
+ < Image source = { require ( '../image/user_article_no_data.png' ) }
120
+ style = { styles . image } />
121
+ }
122
+ </ View >
123
+ </ View >
124
+ < View style = { { height : 1 / PixelRatio . get ( ) , backgroundColor : '#f1f1f1' } } > </ View >
125
+ </ View >
126
+ ) ;
127
+ }
128
+
147
129
_closeBtCallback ( ) {
148
130
this . setState ( { isHotPanelShow : false } ) ;
149
131
}
0 commit comments