Skip to content

Commit c3953e5

Browse files
committed
add
1 parent b382ffb commit c3953e5

File tree

2 files changed

+46
-3
lines changed

2 files changed

+46
-3
lines changed

js/pages/SearchPage.js

+43-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import ProjectModel from '../model/ProjectModel'
1818
import FavoriteDao from '../expand/dao/FavoriteDao'
1919
import Utills from '../util/Utills'
2020
import RepositoryCell from '../common/RepositoryCell'
21+
import LanguageDao,{FLAG_LANGUAGE} from '../expand/dao/LanguageDao'
2122

2223
const API_URL = 'https://api.github.com/search/repositories?q='
2324
const QUERY_STR = '&sort=stars&order=desc'
@@ -27,15 +28,26 @@ export default class SearchPage extends Component {
2728
super(props)
2829
this.favoriteDao = new FavoriteDao(FLAG_STORAGE.flag_popular)
2930
this.favoriteKeys=[]
31+
this.keys = []
32+
this.languageDao = new LanguageDao(FLAG_LANGUAGE.flag_key)
3033
this.state = {
3134
rightBtnText:'Search',
3235
isLoading:false,
36+
showBottomBtn: true,
3337
dataSource: new ListView.DataSource({
3438
rowHasChanged:(r1,r2)=>r1!=r2
3539
})
3640
}
3741
}
38-
42+
componentDidMount() {
43+
this.initKeys()
44+
}
45+
/**
46+
* 获取所有标签
47+
*/
48+
async initKeys() {
49+
this.keys = await this.languageDao.fetch()
50+
}
3951
loadData(){
4052
this.updateState({
4153
isLoading:true
@@ -192,11 +204,29 @@ loadData(){
192204
{indicatorView}
193205
{listView}
194206
</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
196225
return <View style={GlobalStyles.root_container}>
197226
{statusbar}
198227
{this.renderNavBar()}
199228
{resultView}
229+
{bottomBtn}
200230
<Toast
201231
ref={toast=>this.toast=toast}
202232
></Toast>
@@ -228,5 +258,16 @@ const styles = StyleSheet.create({
228258
alignItems: 'center',
229259
justifyContent: 'center',
230260
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
231272
}
232273
})

res/styles/GlobalStyles.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/**
22
* 全局样式
33
*/
4-
4+
import { Dimensions } from 'react-native'
5+
const {height,width} = Dimensions.get('window')
56
module.exports = {
67
line:{
78
// flex:1,
@@ -15,4 +16,5 @@
1516
},
1617
nav_bar_height_ios:44,
1718
nav_bar_height_android:50,
19+
window_height: height
1820
}

0 commit comments

Comments
 (0)