index.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. import React , { useState } from 'react';
  2. import { StyleSheet, Text, View, TextInput, Button } from 'react-native';
  3. import Types from '../../lib/Types';
  4. export default class BaseHolder extends React.Component {
  5. constructor(props){
  6. super(props);
  7. }
  8. render() {
  9. let {
  10. children,
  11. selected,
  12. justifyContent,
  13. alignItems,
  14. alignContent,
  15. flexDirection,
  16. flexWrap,
  17. flexFlow,
  18. order,
  19. alignSelf,
  20. flexGrow,
  21. flexShrink,
  22. flexBasis,
  23. width,
  24. height,
  25. overflow,
  26. CoreSystem,
  27. stretchContainer,
  28. content,
  29. ...restProps
  30. } = this.props;
  31. if(!width) width = undefined;
  32. if(!height) height = undefined;
  33. let styl = [styles.base];
  34. if (CoreSystem._devMode && selected) styl.push(styles.selected);
  35. if (stretchContainer) styl.push(styles.stretchToContent);
  36. return (
  37. // self container
  38. <View {...restProps} style={[styl, {
  39. alignSelf,
  40. flexGrow,
  41. flexShrink,
  42. flexBasis,
  43. width,
  44. height,
  45. overflow
  46. }]}>
  47. {content}
  48. <View WRAPPER={true} style={ //children Container
  49. [
  50. (!!content || stretchContainer) ? styles.stretchToContent : {},
  51. {
  52. justifyContent,
  53. alignItems,
  54. alignContent,
  55. flexDirection,
  56. flexWrap,
  57. flexFlow
  58. }
  59. ]}>
  60. {children}
  61. </View>
  62. </View>
  63. );
  64. }
  65. }
  66. const styles = StyleSheet.create({
  67. base: {
  68. minHeight: 20,
  69. // borderColor: 'blue',
  70. // borderWidth: 1
  71. },
  72. stretchToContent: {
  73. position: 'absolute',
  74. top: 0,
  75. left: 0,
  76. bottom: 0,
  77. right: 0,
  78. // borderColor: 'red',
  79. // borderWidth: 1
  80. },
  81. contentWrapper: {
  82. },
  83. selected: {
  84. borderWidth: 1,
  85. borderColor: '#f28d8d',
  86. shadowColor: "rgba(250,10,0,0.81)",
  87. shadowOffset: {
  88. width: 0,
  89. height: 4,
  90. },
  91. shadowOpacity: 0.30,
  92. shadowRadius: 4.65,
  93. elevation: 8
  94. // border: '1px solid green'
  95. }
  96. });
  97. BaseHolder.Inputs = {
  98. width: new Types.Integer(),
  99. height: new Types.Integer(),
  100. stretchContainer: new Types.Bool().default(false),
  101. overflow: new Types.Text().default('visible'),
  102. justifyContent: new Types.Text().default("flex-start"),
  103. alignItems: new Types.Text(),
  104. alignContent: new Types.Text(),
  105. flexDirection: new Types.Text(),
  106. flexWrap: new Types.Text(),
  107. flexFlow: new Types.Real(),
  108. alignSelf: new Types.Text(),
  109. flexGrow: new Types.Real(),
  110. flexShrink: new Types.Real(),
  111. flexBasis: new Types.Real()
  112. }