NoDataView.js 1.65 KB
'use strict';

import React from 'react';
import ReactNative from 'react-native';

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

import Immutable, {Map} from 'immutable';

export default class NoDataView extends React.Component {

    constructor(props) {
        super (props);
    }

    shouldComponentUpdate(nextProps){
        if (Immutable.is(nextProps.resource, this.props.resource)) {
            return false;
        } else {
            return true;
        }
    }

    render() {
		return (
            <View style={styles.container}>
				<Image source={require('../../image/yhq_icon.png')} style={styles.noLimitCodeIcon}></Image>
				<Text style={styles.text}>你还没有优惠券</Text>
				<TouchableOpacity activeOpacity={1} style={styles.button}
				   onPress={() => {
						this.props.onPressMore && this.props.onPressMore()
				   }}
				>
					<Text style={styles.buttonText}>随便逛逛</Text>
				</TouchableOpacity>
            </View>
        );
    }
}

let {width, height} = Dimensions.get('window');
let iconHeight = Math.ceil((80 / 640) * width);
let iconWidth = Math.ceil((153 / 640) * width);
let iconTop = Math.ceil((200 / 640) * width);

let styles = StyleSheet.create({
	container: {
		flex: 1,
		alignItems: 'center',
		backgroundColor: 'white',
	},
	noLimitCodeIcon: {
		width: iconWidth,
		height: iconHeight,
		marginTop: iconTop,
	},
	text: {
		marginTop: 30,
		fontSize: 12,
	},
	button: {
		marginTop: 60,
		width: 200,
		height: 40,
		backgroundColor: 'black',
		alignItems: 'center',
		justifyContent: 'center',
	},
	buttonText: {
		color: 'white',
		fontSize: 15,
	},
});