PostingToolBar.js
3.73 KB
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
'use strict'
import React, {Component} from 'react';
import {
View,
Text,
Image,
TouchableOpacity,
Platform,
Dimensions,
StyleSheet,
} from 'react-native';
export default class PostingToolBar extends Component {
static propTypes = {
imageCount: React.PropTypes.number,
selectedSectionName: React.PropTypes.string,
onPressImage: React.PropTypes.func,
onPressTrigger: React.PropTypes.func,
onPressSection: React.PropTypes.func,
};
constructor(props) {
super(props);
}
componentDidMount() {
}
render() {
let {imageCount, selectedSectionName, keyboardInView, imageInView} = this.props;
let keyboardImage = keyboardInView ? require('../../images/posting/jianpan1.png') : require('../../images/posting/keyboard_normal.png');
let picImage = imageInView ? require('../../images/posting/pic1.png') : require('../../images/posting/pic_normal.png')
return (
<View style={styles.container}>
<TouchableOpacity style={styles.imgIcon} onPress={() => {
this.props.onPressImage && this.props.onPressImage();
}}>
<Image source={picImage}/>
{imageCount > 0 ? <Text style={styles.imageCountText}>{imageCount}</Text> : null}
</TouchableOpacity>
<TouchableOpacity style={styles.keyboardIcon} onPress={() => {
this.props.onPressTrigger && this.props.onPressTrigger();
}}>
<Image style={styles.keyboardIcon} source={keyboardImage} />
</TouchableOpacity>
<View style={styles.rightContainer}>
<Text
style={styles.sectionName}
suppressHighlighting={true}
onPress={() => {
this.props.onPressSection && this.props.onPressSection();
}}
>
{selectedSectionName}
</Text>
</View>
<View style={styles.toolTopLine}/>
<View style={styles.toolBottomLine}/>
</View>
);
}
}
let {width, height} = Dimensions.get('window');
const styles = StyleSheet.create({
container: {
flexDirection: 'row',
alignItems:'center',
justifyContent: 'center',
right:0,
left:0,
height: 41,
marginBottom:0,
},
toolTopLine: {
position: 'absolute',
left: 0,
top: 0,
width: width,
height: 0.5,
backgroundColor: '#e0e0e0',
},
toolBottomLine: {
position: 'absolute',
left: 0,
bottom: 0,
width: width,
height: 0.5,
backgroundColor: '#e0e0e0',
},
imgIcon: {
flexDirection: 'row',
left: 15,
width: 19,
height: 19,
marginRight: 29,
},
keyboardIcon: {
width: 20,
height: 20,
},
rightContainer: {
flexDirection: 'column',
alignItems: 'flex-end',
height: 41,
width: width-68,
},
sectionName: {
fontSize:14,
textAlign: 'center',
height: 21,
paddingLeft: 10,
paddingRight: 10,
paddingTop: 3,
marginRight: 10,
marginTop: 10,
backgroundColor: '#f2f2f2',
},
imageCountText: {
alignItems: 'center',
fontSize: 9,
color: '#d0021b',
textAlign: 'center',
width: 15,
height: 15,
left: -8,
top: -7,
paddingTop: 1.5,
borderRadius: 7.5,
borderWidth: 0.5,
borderColor: '#d0021b',
},
});