index.js 1.4 KB

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