-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.js
65 lines (59 loc) · 2.12 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
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
Image,
TouchableOpacity,
View
} from 'react-native';
import TabNavigator from 'react-native-tab-navigator'
// import MainScreenNavigator from './movietab'
import MovieTab from './MovieTab'
import BeautyTab from './BeautyTab'
export default class Main extends Component {
constructor(props) {
super(props);
this.state = {selectedTab:'beauty' };
}
render() {
return (<TabNavigator>
<TabNavigator.Item
selected={this.state.selectedTab==='beauty'}
title="美女"
selectedTitleStyle={{color:'red',marginTop:3}}
renderIcon={()=><Image style={styles.icon} source={require('./image/beauty.png')} />}
renderSelectedIcon={() =>
<Image style={styles.icon} source={require('./image/beauty_press.png')}/>}
onPress={()=>this.setState({selectedTab:'beauty'})}
>
<BeautyTab nav={this.props.navigation}></BeautyTab>
</TabNavigator.Item>
<TabNavigator.Item
selected={this.state.selectedTab==='movie'}
title="电影"
selectedTitleStyle={{color:'red',marginTop:3}}
renderIcon={()=><Image style={styles.icon} source={require('./image/movie.png')} />}
renderSelectedIcon={() =>
<Image style={styles.icon} source={require('./image/movie_press.png')}/>}
onPress={()=>this.setState({selectedTab:'movie'})}
>
<MovieTab nav={this.props.navigation}></MovieTab>
</TabNavigator.Item>
</TabNavigator>);
}
componentWillUnmount(){
this.listener.remove();
}
}
const styles = StyleSheet.create({
icon:{
width:25,
height:25,
}
});