-
Notifications
You must be signed in to change notification settings - Fork 62
/
Copy pathTitleBarForDetail.js
98 lines (84 loc) · 1.83 KB
/
TitleBarForDetail.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
'use strict';
var React = require('react-native');
var {
Image,
PixelRatio,
StyleSheet,
Text,
Platform,
View,
Dimensions,
TouchableHighlight,
TouchableNativeFeedback,
} = React;
var titleBarHeight = Dimensions.get('window').height / 12;
var titleBarMarginTop = 0;
if (Platform.OS === 'ios') {
titleBarMarginTop = 10;
}
var TouchableElement = TouchableHighlight;
if (Platform.OS === 'android') {
TouchableElement = TouchableNativeFeedback;
}
var TitleBarForDetail = React.createClass({
_onPressBackButton: function() {
if (this.props.navigator) {
this.props.navigator.pop();
}
},
render: function() {
return (
<View>
<View style={styles.container}>
<TouchableElement onPress={this._onPressBackButton}>
<View style={styles.actionItem}>
<Image
style={styles.searchButton}
source={require('./images/ic_back.png')}
resizeMode='contain' />
</View>
</TouchableElement>
<Text style={styles.titleText} >
{this.props.title}
</Text>
<View style={{flex: 1}}>
</View>
</View>
</View>
);
}
});
var styles = StyleSheet.create({
container: {
flex:1,
flexDirection: "row",
marginTop: titleBarMarginTop,
alignItems: 'center',
height: titleBarHeight,
backgroundColor: '3e9ce9',
},
titleText: {
fontSize: 18,
marginLeft: 10,
color: 'white'
},
titleBarSplitLine: {
height: 0,
backgroundColor: '#e5e5e5',
},
searchButton: {
width: 32,
height: 32,
marginLeft: 8,
marginRight: 8,
},
actionItem: {
height: 56,
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center',
paddingLeft: 8,
paddingRight: 8,
},
});
module.exports = TitleBarForDetail;