3
0

index.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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. order,
  18. alignSelf,
  19. flexGrow,
  20. flexShrink,
  21. flexBasis,
  22. width,
  23. height,
  24. paddingTop,
  25. paddingBottom,
  26. marginLeft,
  27. marginRight,
  28. overflow,
  29. CoreSystem,
  30. stretchContainer,
  31. content,
  32. ...restProps
  33. } = this.props;
  34. if(!width) width = undefined;
  35. if(!height) height = undefined;
  36. let styl = [styles.base];
  37. if (CoreSystem && CoreSystem._devMode && selected) styl.push(styles.selected);
  38. if (stretchContainer) styl.push(styles.stretchToContent);
  39. return (
  40. // self container
  41. <View {...restProps} style={[styl, {
  42. alignSelf,
  43. flexGrow,
  44. flexShrink,
  45. flexBasis,
  46. width,
  47. height,
  48. paddingTop,
  49. paddingBottom,
  50. marginLeft,
  51. marginRight,
  52. overflow,
  53. pointerEvents: 'auto'
  54. }]}>
  55. {content}
  56. <View WRAPPER={true} style={ //children Container
  57. [
  58. (!!content || stretchContainer) ? styles.stretchToContent : {},
  59. {
  60. pointerEvents: 'none',
  61. justifyContent,
  62. alignItems,
  63. alignContent,
  64. flexDirection,
  65. flexWrap
  66. }
  67. ]}>
  68. {children}
  69. </View>
  70. </View>
  71. );
  72. }
  73. }
  74. const styles = StyleSheet.create({
  75. base: {
  76. minHeight: 10,
  77. // borderColor: 'blue',
  78. // borderWidth: 1
  79. },
  80. stretchToContent: {
  81. position: 'absolute',
  82. top: 0,
  83. left: 0,
  84. bottom: 0,
  85. right: 0,
  86. // borderColor: 'red',
  87. // borderWidth: 1
  88. },
  89. contentWrapper: {
  90. },
  91. selected: {
  92. borderWidth: 1,
  93. borderColor: '#f28d8d',
  94. shadowColor: "rgba(250,10,0,0.81)",
  95. shadowOffset: {
  96. width: 0,
  97. height: 4,
  98. },
  99. shadowOpacity: 0.30,
  100. shadowRadius: 4.65,
  101. elevation: 8
  102. // border: '1px solid green'
  103. }
  104. });
  105. BaseHolder.Inputs = {
  106. width: new Types.Integer(),
  107. height: new Types.Integer(),
  108. paddingTop: new Types.Integer(),
  109. paddingBottom: new Types.Integer(),
  110. marginLeft: new Types.Integer().default(0),
  111. marginRight: new Types.Integer().default(0),
  112. stretchContainer: new Types.Bool().default(false),
  113. overflow: new Types.Text().default('visible'),
  114. justifyContent: new Types.Text().default("flex-start"),
  115. alignItems: new Types.Text(),
  116. alignContent: new Types.Text(),
  117. flexDirection: new Types.Text(),
  118. flexWrap: new Types.Text(),
  119. alignSelf: new Types.Text(),
  120. flexGrow: new Types.Real(),
  121. flexShrink: new Types.Real(),
  122. flexBasis: new Types.Real()
  123. }