forked from nhs-nobleep/app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnavbar.js
74 lines (69 loc) · 1.48 KB
/
navbar.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
'use strict';
var React = require('react-native');
var {
Image,
Navigator,
Platform,
StyleSheet,
Text,
TouchableOpacity,
View
} = React;
var styles = StyleSheet.create({
navBar: {
backgroundColor: "#000",
height: 64
},
navBarText: {
color: '#FFF',
fontSize: 17,
fontWeight: 'bold',
marginTop: (Platform.OS === 'ios') ? 12 : 24
},
navBarTitleContainer: {
alignSelf: 'center',
paddingRight: (Platform.OS === 'ios') ? 0 : 74
},
navBarTitleText: {
textAlign: 'center'
},
navBarLeftButton: {
paddingLeft: 10,
marginTop: (Platform.OS === 'ios') ? 0 : 8
},
navBarRightButton: {
paddingRight: 10,
}
});
var NavigationBarRouteMapper = {
Title(route, navigator, index, navState) {
return (
<View style={styles.navBarTitleContainer}>
<Text style={[styles.navBarText, styles.navBarTitleText]}>
{route.title}
</Text>
</View>
);
},
LeftButton(route, navigator, index, navState) {
if (index === 0) {
return null;
}
// var previousRoute = navState.routeStack[index - 1];
return (
<TouchableOpacity
onPress={() => navigator.pop()}
style={styles.navBarLeftButton}>
<Text style={styles.navBarText}>Back</Text>
</TouchableOpacity>
);
},
RightButton(route, navigator, index, navState) {
return null;
}
};
module.exports = (
<Navigator.NavigationBar
style={styles.navBar}
routeMapper={NavigationBarRouteMapper} />
);