123456789101112131415161718192021222324252627282930313233343536 |
- import React from 'react';
- import Types from '../../lib/Types';
- import Module from '../../lib/Module';
- import { View, Image } from 'react-native';
- let image = require('./assets/default.jpg')
- export default class ImageComp extends Module {
- constructor(props) {
- super(props);
- this.setContainerStyle({ marginLeft: 0, marginRight: 0});
- }
- display() {
- let {
- width,
- height,
- resizeMode,
- source
- } = this.props;
- console.log(width);
- if(!width) width = "100%";
- return <Image
- style={{width, height, paddingTop: height ? '0' : '56.25%'}}
- resizeMode={resizeMode}
- source={source || image}
- />
- }
- }
- ImageComp.Inputs = {
- source: new Types.Text(),
- width: new Types.Integer(),
- height: new Types.Integer(),
- resizeMode: new Types.Text().require().default('cover')
- }
|