-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
97 lines (94 loc) · 3.64 KB
/
main.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
import React, { Component } from 'react';
import { Text,Image,View,StyleSheet } from 'react-native'
import { Router, Scene } from 'react-native-router-flux';//引入包
import index1 from './app/components/index1' //引入文件
import index2 from './app/components/index2'//引入文件
import index3 from './app/components/index3'
import index4 from './app/components/index4'
import index5 from './app/components/index5'
import Test from './app/components/test'
import indexA1 from './app/components/index1-1'
import indexA2 from './app/components/index1-2'
import indexA3 from './app/components/index1-3'
import indexB1 from './app/components/index4-1'
const TabIcon = ({ selected, title }) => {
let icon = selected ? require('./app/images/home1.png') : require('./app/images/home.png')
let icon1 = selected ? require('./app/images/my1.png') : require('./app/images/my.png')
if(title=='主页'){
return (
<View style={styles.imgview}>
<Image style={styles.img} source={icon} />
<Text style={[styles.text,{color: selected ? 'red' :'black'}]}>{title}</Text>
</View>
)
}else {
return (
<View style={styles.imgview}>
<Image style={styles.img} source={icon1} />
<Text style={[styles.text,{color: selected ? 'red' :'black'}]}>{title}</Text>
</View>
)
}
}
class App extends Component {
constructor(props) {
super(props);
this.state = {
}
}
_navBarContent(){
return(
<View><Text>bbb</Text></View>
)
}
render(){
return (
<Router>
<Scene key="root" >
<Scene key="tabbar" tabs={true} tabBarStyle={styles.tabBarStyle} >
<Scene key="aaa" title="主页" icon={TabIcon} initial={true} component={index1} title="主页" hideNavBar />
<Scene key="bbb" title="搜索" icon={TabIcon} component={index2} title="搜索" />
<Scene key="eee" title="手势" icon={TabIcon} >
<Scene key="test" titleStyle={{color:'red'}} navigationBarStyle={styles.navigationBarStyle} component={Test} title="手势响应测试" />
</Scene>
<Scene swipeEnabled={true} key="ccc" title="订单" icon={TabIcon}>
<Scene key="order" component={index3} title="订单" />
</Scene>
<Scene key="ddd" title="我的" icon={TabIcon}>
<Scene key="mine" component={index4} title="我的" />
</Scene>
</Scene>
<Scene key="setting" component={index5} title="设置" hideTabBar />
<Scene key="A1" component={indexA1} title="A1" hideTabBar />
<Scene key="A2" component={indexA2} title="A2" hideTabBar />
<Scene key="A3" component={indexA3} title="A3" hideTabBar />
<Scene key="B1" component={indexB1} title="B1" hideTabBar />
</Scene>
</Router>
)
}
}
const styles = StyleSheet.create({
imgview:{
justifyContent:'center',
alignItems:'center'
},
img:{
height:20,
width:20
},
text:{
fontSize:12
},
tabBarStyle:{
backgroundColor:'#ececec',
borderTopWidth:1,
borderTopColor:'red'
},
navigationBarStyle:{
backgroundColor:'#a2cbda',
borderBottomWidth:1,
borderBottomColor:'red'
}
})
export default App