-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.js
executable file
·158 lines (147 loc) · 3.92 KB
/
App.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
import React, { Component } from 'react';
import {
Platform,
StyleSheet,
Text,
View,
Image,
ActivityIndicator,
StatusBar
} from 'react-native';
import { StackNavigator } from 'react-navigation';
import TabNavigator from 'react-native-tab-navigator';
import User from './User_/User';
import Museum_Home_list from './Museum/home_list';
import News_Home_list from './News/home_list';
import Food_Home_list from './Food/food_home_list';
export default class App extends Component {
constructor(props) {
super(props);
this.state = {
Height:60,
tab:"景点",
value:"old",
user:"",
statement:"",
};
global.username="";
global.statement="";
global.id=null;
_this = this;
}
_one(){
this.setState({tab:'景点'})
}
_onPress(data){
var height = _this.state.Height;
var height = 0;
if(data){
height = 60;
}else{
height = 0;
}
_this.setState({
Height:height
});
}
render() {
return (
<TabNavigator
sceneStyle={{
paddingBottom:this.state.Height
}}
tabBarStyle={{
height:this.state.Height,
overflow:'hidden'
}}
style={{flex:1}}
tabBarStyle={{
backgroundColor:'#dcdcdc',
height:this.state.Height,
}}
>
<TabNavigator.Item
title="景点"
selected={this.state.tab==='景点'}
onPress={()=>this._one()}
renderIcon={()=><Image
style={{width:60,height:this.state.Height/2}}
source={require('./Image/hourse.png')}></Image>}
>
<Museum_Home_list
/>
</TabNavigator.Item>
<TabNavigator.Item
title="食物"
selected={this.state.tab==='食物'}
onPress={()=>{
this.setState({tab:'食物'})
}}
renderIcon={()=><Image
style={{width:40,height:this.state.Height/2}}
source={require('./Image/food.png')}></Image>}
>
<Food_Home_list/>
</TabNavigator.Item>
<TabNavigator.Item
title="新闻消息"
selected={this.state.tab==='新闻消息'}
onPress={()=>{
this.setState({tab:'新闻消息'});
}}
renderIcon={()=><Image
style={{width:35,height:this.state.Height/2}}
source={require('./Image/news.png')}></Image>}
>
<News_Home_list/>
</TabNavigator.Item>
<TabNavigator.Item
title="用户"
selected={this.state.tab==='用户'}
onPress={()=>{
this.setState({tab:'用户'});
}}
renderIcon={()=><Image
style={{width:35,height:this.state.Height/2+5}}
source={require('./Image/my.png')}></Image>}
>
<User
op={this._onPress}
/>
</TabNavigator.Item>
</TabNavigator>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
container_user: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
user_:{
fontSize: 20,
marginTop:20,
textAlign:'center',
color:'blue',
fontStyle:'italic',
textDecorationLine:'underline'
}
});