SPShareGoodsCell.js 1.78 KB
'use strict';

import React from 'react';
import ReactNative from 'react-native';
import ImmutablePropTypes from 'react-immutable-proptypes';
import SlicedImage from '../../../common/components/SlicedImage';

const {
    View,
    Text,
    Image,
    TouchableOpacity,
    StyleSheet,
    Dimensions,
} = ReactNative;

export default class SPShareGoodsCell extends React.Component {

    constructor(props) {
        super (props);

    }

    render() {
        let {goodsImage, productName, salesPrice} = this.props.data;
        return (
            <TouchableOpacity onPress={() => {
                this.props.onPressShareGoods && this.props.onPressShareGoods();
            }}>
                <View style={styles.container}>
                    <SlicedImage style={styles.shareGoodsImage} source={{uri: goodsImage}}/>
                    <View style={styles.shareGoodsRightPannel}>
                        <Text style={styles.productNameText}>{productName}</Text>
                        <Text style={styles.productPriceText}>{'¥' + salesPrice}</Text>
                    </View>
                </View>
            </TouchableOpacity>
        );
    }
}

let {width, height} = Dimensions.get('window');
let lineWidth = width - 30;

let styles = StyleSheet.create({
    container: {
        flexDirection: 'row',
        paddingLeft: 15,
        paddingBottom: 10,
        backgroundColor: 'white',
    },
    shareGoodsImage: {
        width: 52,
        height: 70,
        backgroundColor:'gray',
    },
    shareGoodsRightPannel: {
        flexDirection: 'column',
        paddingLeft: 10,
        paddingTop: 5,
    },
    productNameText: {
        fontSize: 15,
        width: width - 52 - 30,
    },
    productPriceText: {
        top: 10,
        fontSize: 12,
        color: '#d0021b',
    },
});