@@ -18,6 +18,7 @@ import ProjectModel from '../model/ProjectModel'
18
18
import FavoriteDao from '../expand/dao/FavoriteDao'
19
19
import Utills from '../util/Utills'
20
20
import RepositoryCell from '../common/RepositoryCell'
21
+ import LanguageDao , { FLAG_LANGUAGE } from '../expand/dao/LanguageDao'
21
22
22
23
const API_URL = 'https://api.github.com/search/repositories?q='
23
24
const QUERY_STR = '&sort=stars&order=desc'
@@ -27,15 +28,26 @@ export default class SearchPage extends Component {
27
28
super ( props )
28
29
this . favoriteDao = new FavoriteDao ( FLAG_STORAGE . flag_popular )
29
30
this . favoriteKeys = [ ]
31
+ this . keys = [ ]
32
+ this . languageDao = new LanguageDao ( FLAG_LANGUAGE . flag_key )
30
33
this . state = {
31
34
rightBtnText :'Search' ,
32
35
isLoading :false ,
36
+ showBottomBtn : true ,
33
37
dataSource : new ListView . DataSource ( {
34
38
rowHasChanged :( r1 , r2 ) => r1 != r2
35
39
} )
36
40
}
37
41
}
38
-
42
+ componentDidMount ( ) {
43
+ this . initKeys ( )
44
+ }
45
+ /**
46
+ * 获取所有标签
47
+ */
48
+ async initKeys ( ) {
49
+ this . keys = await this . languageDao . fetch ( )
50
+ }
39
51
loadData ( ) {
40
52
this . updateState ( {
41
53
isLoading :true
@@ -192,11 +204,29 @@ loadData(){
192
204
{ indicatorView }
193
205
{ listView }
194
206
</ View >
195
-
207
+ let bottomBtn = this . state . showBottomBtn ?
208
+ < TouchableOpacity
209
+ style = { [ styles . btn , { backgroundColor :'#6495ED' } ] }
210
+ >
211
+ < View
212
+ style = { {
213
+ justifyContent : 'center'
214
+ } }
215
+ >
216
+ < Text
217
+ style = { {
218
+ fontSize : 18 ,
219
+ color : 'white' ,
220
+ fontWeight : '500'
221
+ } }
222
+ > add Tab</ Text >
223
+ </ View >
224
+ </ TouchableOpacity > :null
196
225
return < View style = { GlobalStyles . root_container } >
197
226
{ statusbar }
198
227
{ this . renderNavBar ( ) }
199
228
{ resultView }
229
+ { bottomBtn }
200
230
< Toast
201
231
ref = { toast => this . toast = toast }
202
232
> </ Toast >
@@ -228,5 +258,16 @@ const styles = StyleSheet.create({
228
258
alignItems : 'center' ,
229
259
justifyContent : 'center' ,
230
260
flex : 1
261
+ } ,
262
+ btn : {
263
+ alignItems : 'center' ,
264
+ justifyContent : 'center' ,
265
+ opacity : 0.9 ,
266
+ height :40 ,
267
+ position : 'absolute' ,
268
+ left : 10 ,
269
+ right : 10 ,
270
+ top : GlobalStyles . window_height - 45 ,
271
+ borderRadius : 3
231
272
}
232
273
} )
0 commit comments