EditIconView.js 1.35 KB
'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,
    },

})