NoDataView.js 1.79 KB
'use strict';

import React from 'react';
import ReactNative from 'react-native';
import GetPurchaseCell from './GetPurchaseCell';

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}>
				<GetPurchaseCell resource={'0'} onPressHowToGetCodeLink={this.props.onPressHowToGetCodeLink}/>
				<Image source={require('../../image/lp_mineList_empty.png')} style={styles.noLimitCodeIcon} />
				<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((146 / 640) * width);
let iconWidth = Math.ceil((120 / 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,
	},
});