-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
88 lines (78 loc) · 1.67 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
import React from 'react';
import {
View,
Text,
StyleSheet,
Button,
Image
} from 'react-native';
import {DrawerNavigator} from 'react-navigation';
class Contact extends React.Component {
static navigationOptions = {
drawerLabel: 'Notifications标题'
};
render() {
const {navigate} = this.props.navigation;
return (
<View style={styles.container}>
<Text onPress={() =>
navigate('Home2', {name: '从Home到HOme2'})
}>跳到新页面</Text>
<Text onPress={() =>
navigate('DrawerOpen')
}>打开抽屉</Text>
</View>
)
}
}
class MyNotificationsScreen extends React.Component {
static navigationOptions = {
drawerLabel: 'Notifications标题'
};
render() {
return (
<Button
onPress={() => this.props.navigation.goBack()}
title="Go back home"
/>
);
}
}
const Drawer = DrawerNavigator({
Contact: {
screen: Contact,
navigationOptions:{
drawerLabel:'帅气Home',
headerTitle:'home title'
}
},
Notifications: {
screen: MyNotificationsScreen
},
Notifications2: {
screen: MyNotificationsScreen
}
}, {
drawerWidth: 200, //抽屉的宽度
drawerPosition: 'left' , //选项是left和right.默认是left
// contentComponent:(navigation)=><Text>asa</Text>,
contentOptions: {
activeTintColor: '#e91e63',
itemsContainerStyle: {
marginVertical: 0
},
iconContainerStyle: {
opacity: 1
}
}
});
const styles = StyleSheet.create({
container: {
marginTop: 22
},
icon: {
width: 24,
height: 24
}
});
export default Drawer;