import React from 'react';
import Types from '../lib/Types';
import Module from '../lib/Module';
import { View, Image } from 'react-native';

export default class ImageComp extends Module {
	constructor(props) {
		super(props);

	}

	display() {
		let {
			width,
			height,
			resizeMode,
			source
		} = this.props;
		if(!width) width = ImageComp.Inputs.width.default;
		if(!height) height = ImageComp.Inputs.height.default;
		if(!resizeMode) resizeMode = ImageComp.Inputs.resizeMode.default;
		return 	<Image
			          style={{width, height}}
			          resizeMode={resizeMode}
			          source={source || require('./assets/default.jpg')}
			        />
	}
}


ImageComp.Inputs = {
	source: new Types.Text(),
	width: new Types.Integer().require().default(100),
	height: new Types.Integer().require().default(100),
	resizeMode: new Types.Text().require().default('cover')
}