ListHeader.js 1.92 KB
import React, { Component } from 'react';
import {
  StyleSheet,
  Text,
  View,
  Image,
  Dimensions,
} from 'react-native';

export default class ListHeader extends Component {
    constructor(props) {
        super(props);
    }

    render(){
        let title=this.props.data.get('order_title','');
        let orderStatus=this.props.data.get('status_str','');
        let shouldShowIcon=this.props.data.get('order_type') == 7;
        let src=require('../../image/huanhuo_ic.png');
        return(
            <View style={styles.container}>
                <View style={styles.orderContainer}>
                    <View style={styles.codeStyle}>
                        <Text style={styles.title}>
                            {title}
                        </Text>
                        {shouldShowIcon?<Image style={styles.imageStyle} source={src}/>:null}
                    </View>
                    <Text style={styles.status}>
                        {orderStatus}
                    </Text>
                </View>
            </View>
        );
    }
}

let {w,h} = Dimensions.get('window');
const styles = StyleSheet.create({
    container: {
        flexDirection: 'column',
        borderColor: '#e5e5e5',
        borderBottomWidth: 1,
        borderTopWidth:1,
    },
    orderContainer: {
        width: w,
        height: 56,
        backgroundColor: 'white',
        flexDirection: 'row',
        alignItems: 'center',
        justifyContent: 'space-between'
    },
    codeStyle: {
        flexDirection: 'row',
        alignItems: 'center',
        marginLeft: 15,
    },
    title: {
        fontSize: 16,
        fontFamily: 'STHeitiSC-Light',
        color: '#444444',
    },
    status: {
        fontSize: 16,
        fontFamily: 'STHeitiSC-Light',
        color: '#444444',
        marginRight: 15,
    },
    imageStyle: {
        backgroundColor: 'transparent',
        alignItems: 'center',
        marginLeft: 10,
    },
});