-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ios.js
95 lines (82 loc) · 2.17 KB
/
index.ios.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/**
* T50 电影排行榜前50
* 基于豆瓣的电影列表
*/
'use strict';
import React from 'react-native';
import styles from './app/Styles/Main';
import icons from './app/Assets/Icons';
import MovieList from './app/Components/MovieList';
import USBox from './app/Components/USBox';
import Featured from './app/Components/Featured';
import Search from './app/Components/Search';
var {
AppRegistry,
StyleSheet,
Text,
View,
Image,
ListView,
TabBarIOS,
ScrollView,
} = React;
let REQUEST_URL = 'https://api.douban.com/v2/movie/top250?count=20&start=0';
class T50 extends React.Component{
constructor(props){
super(props);
this.state = {
selectedTab:'featured',
};
}
renderT50(){
return(
<TabBarIOS barTintColor = "darkslateblue" tintColor = "white">
<TabBarIOS.Item
icon = {{uri: icons.star, scale: 4.6}}
title = "推荐电影"
selectedIcon = {{uri: icons.starActive, scale: 4.6}}
selected = {this.state.selectedTab === 'featured'}
onPress={() => {
this.setState({
selectedTab: 'featured'
})
}}>
<Featured />
</TabBarIOS.Item>
<TabBarIOS.Item
icon = {{uri: icons.board, scale: 4.6}}
title = "北美票房"
selectedIcon = {{uri: icons.boardActive, scale: 4.6}}
selected = {this.state.selectedTab === 'us_box'}
onPress={() => {
this.setState({
selectedTab: 'us_box'
})
}}>
<USBox />
</TabBarIOS.Item>
<TabBarIOS.Item
icon = {{uri: icons.search, scale: 4.6}}
title = "搜索"
selected = {this.state.selectedTab === 'search'}
onPress={()=>{
this.setState({
selectedTab: 'search'
})
}}>
<Search />
</TabBarIOS.Item>
</TabBarIOS>
);
}
render(){
return this.renderT50();
}
}
let sty = StyleSheet.create({
sItem:{
borderWidth:1, borderColor:'red', height:100, width:70,
backgroundColor:'#fff',margin:5,
}
});
AppRegistry.registerComponent('T50', () => T50);