EditIconView.js
1.35 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
'use strict';
import React, {Component} from 'react';
import ReactNative, {
View,
Image,
Dimensions,
StyleSheet,
TouchableOpacity
} from 'react-native';
export default class EditIconView extends Component {
constructor(props) {
super(props);
}
render() {
let{isSelected} = this.props;
let image = isSelected ? require('../../images/message_checked_h.png') : require('../../images/message_checked_n.png');
return(
<View style={[styles.container]}>
<TouchableOpacity
activeOpacity={1}
onPress={() =>{
this.props.onSelectPress&&this.props.onSelectPress();
}}
>
<Image
style={styles.image}
source={image}
/>
</TouchableOpacity>
</View>
)
}
}
let {width, height} = Dimensions.get('window');
const DEVICE_WIDTH_RATIO = width / 375;
let styles = StyleSheet.create({
container: {
width: 50*DEVICE_WIDTH_RATIO,
flexDirection: 'row',
backgroundColor: '#f2f2f2',
justifyContent: 'center',
alignSelf: 'center',
},
image: {
width: 22*DEVICE_WIDTH_RATIO,
height: 22*DEVICE_WIDTH_RATIO,
},
})