3
0

index.js 821 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import React from 'react';
  2. import Types from '../../lib/Types';
  3. import Module from '../../lib/Module';
  4. import { View, Image } from 'react-native';
  5. let image = require('./assets/default.jpg')
  6. export default class ImageComp extends Module {
  7. constructor(props) {
  8. super(props);
  9. }
  10. display() {
  11. let {
  12. width,
  13. height,
  14. resizeMode,
  15. source
  16. } = this.props;
  17. if(!width) width = 100;
  18. if(!height) height = 100;
  19. if(!resizeMode) resizeMode = 'cover';
  20. return <Image
  21. style={{width, height}}
  22. resizeMode={resizeMode}
  23. source={source || image}
  24. />
  25. }
  26. }
  27. ImageComp.Inputs = {
  28. source: new Types.Text(),
  29. width: new Types.Integer().require().default(70),
  30. height: new Types.Integer().require().default(70),
  31. resizeMode: new Types.Text().require().default('cover')
  32. }