1234567891011121314151617181920212223242526272829303132333435363738 |
- 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,
- borderRadius
- } = this.props;
- if(!width) width = "100%";
- return <Image
- style={{borderRadius, 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'),
- borderRadius: new Types.Integer()
- }
|