index.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import React from 'react';
  2. import { StyleSheet, Text, View, TextInput, Button } from 'react-native';
  3. import Module from '../../lib/Module';
  4. import Types from '../../lib/Types';
  5. export default class BaseContainer extends Module {
  6. constructor(props) {
  7. super(props);
  8. }
  9. render() {
  10. let {
  11. selected,
  12. width,
  13. height,
  14. overflow,
  15. // margin, // cannot use margin no children
  16. // padding, // cannot use margin no children
  17. shadowColor,
  18. shadowWidth,
  19. shadowHeight,
  20. shadowOpacity,
  21. shadowRadius,
  22. backgroundColor,
  23. ...restProps
  24. } = this.props;
  25. if(!backgroundColor) backgroundColor = '';
  26. if(!shadowColor) shadowColor = '';
  27. if(!shadowWidth) shadowWidth = 0;
  28. if(!shadowHeight) shadowHeight = 0;
  29. return (
  30. <View {...restProps} style={{width, height, overflow , backgroundColor , shadowColor, shadowOffset:{width:shadowWidth,height:shadowHeight}, shadowOpacity: shadowOpacity, shadowRadius}}>
  31. </View>
  32. );
  33. }
  34. }
  35. BaseContainer.Inputs = {
  36. width: new Types.Integer(),
  37. height: new Types.Integer(),
  38. overflow: new Types.Integer().require().default('hidden'),
  39. backgroundColor: new Types.Text().require().color(),
  40. // margin: new Types.Text().default('0'),
  41. // padding: new Types.Text().default('0'),
  42. shadowColor: new Types.Text().require().color().default(""),
  43. shadowWidth: new Types.Integer().require(),
  44. shadowHeight: new Types.Integer().require(),
  45. shadowOpacity: new Types.Real().default(0),
  46. // shadowElevation: new Types.Integer().default(5),
  47. shadowRadius: new Types.Integer().default(5)
  48. }