-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbak.js
112 lines (102 loc) · 2.94 KB
/
bak.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import React, {
AppRegistry,
Component,
StyleSheet,
Text,
View,
Navigator
} from 'react-native';
import FilmList from "./utils/filmList";
import CinemaList from "./utils/cinemaList";
import User from "./utils/user";
import TabBarItem from "./utils/TabBarItem";
var _getRandomRoute = function (str) {
return {
randNumber: str,
};
}
var ROUTE_STACK = [
_getRandomRoute('FilmList'),
_getRandomRoute('Cinema'),
_getRandomRoute('User'),
];
var routeIndex = 0;
class film extends Component {
constructor(props, params) {
super(props);
this.state = {
tabIndex: 0
}
}
render() {
return (
<Navigator
initialRoute={ROUTE_STACK[routeIndex]}
configureScene={(route) => {
return Navigator.SceneConfigs.FadeAndroid;
} }
renderScene={this.renderScene}
navigationBar={
this.TabBar()
}
initialRouteStack={ROUTE_STACK}
ref={(navigator) => {
this._navigator = navigator;
}}
/>
);
}
renderScene(route, navigator){
var pages =[
<FilmList {...route.params} navigator={navigator} />,
<CinemaList {...route.params} navigator={navigator} />,
<User {...route.params} navigator={navigator} />,
]
return (
pages[routeIndex]
)
}
TabBar() {
return (
<View style={styles.tabs }>
<TabBarItem
underlayColor="#B5B5B5"
image={require("./images/film.png") }
title="影片"
onPress={() => {
this.onTabIndex(0);
this.setState({tabIndex:0})
} }>
></TabBarItem>
<TabBarItem
underlayColor="#B5B5B5"
image={require("./images/cinema.png") }
title="影院"
onPress={() => {
this.onTabIndex(1);
this.setState({tabIndex:1})
} }>
></TabBarItem>
<TabBarItem
underlayColor="#B5B5B5"
image={require("./images/me.png") }
title="我"
onPress={() => {
this.onTabIndex(2);
this.setState({tabIndex:2})
} }>
></TabBarItem>
</View>
)
}
onTabIndex(_index){
routeIndex = _index;
this._navigator.jumpTo(ROUTE_STACK[routeIndex]);
}
}
const styles = StyleSheet.create({
tabs:{
flexDirection:"row"
}
});
AppRegistry.registerComponent('film', () => film);