Header.js
2.31 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
'use strict';
import React from 'react';
import ReactNative from 'react-native';
import Immutable, {Map} from 'immutable';
import DeviceInfo from 'react-native-device-info';
const {
View,
Text,
TouchableOpacity,
Dimensions,
StyleSheet,
Platform,
} = ReactNative;
export default class Header extends React.Component {
constructor(props) {
super (props);
}
render() {
return (
<View style={styles.container}>
<Text style={styles.name}>筛选商品</Text>
<TouchableOpacity onPress={() => {this.props.cancelAction && this.props.cancelAction()}} >
<View style={styles.cancelButton}>
<Text style={styles.cancelText}>清空</Text>
</View>
</TouchableOpacity>
<TouchableOpacity onPress={() => {this.props.okAction && this.props.okAction()}} >
<View style={styles.okButton}>
<Text style={styles.okText}>确定</Text>
</View>
</TouchableOpacity>
</View>
);
}
}
let {width, height} = Dimensions.get('window');
let backgroundWidth = width;
let backgroundHeight = 64;
let buttonHeight = 30;
let buttonWidth = 50;
let rightOffset = 50;
let styles = StyleSheet.create({
container: {
width: backgroundWidth,
height: backgroundHeight,
backgroundColor: 'rgba(46,46,46,1)',
flexDirection: 'row',
},
name: {
fontSize: 14,
color: 'white',
marginTop: backgroundHeight - 20 - 10,
marginLeft: 10,
width: 100,
height: buttonHeight,
backgroundColor: 'transparent',
},
cancelButton: {
height: buttonHeight,
width: buttonWidth,
backgroundColor: 'white',
marginTop: backgroundHeight - buttonHeight - 10,
alignItems: 'center',
justifyContent: 'center',
marginLeft: width - rightOffset - 110 - 10 - 2*buttonWidth - 10,
},
cancelText: {
color: 'black',
},
okButton: {
height: buttonHeight,
width: buttonWidth,
backgroundColor: 'black',
marginTop: backgroundHeight - buttonHeight - 10,
alignItems: 'center',
justifyContent: 'center',
marginLeft: 10,
},
okText: {
color: 'white',
},
});