3
0

Module.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import React, {Fragment} from 'react';
  2. import { View } from 'react-native';
  3. import { Resolver } from './Types';
  4. // EventSystem
  5. export default class Module extends React.Component{
  6. constructor(props) {
  7. super(props);
  8. let {
  9. ModuleID,
  10. EventSystem
  11. } = props;
  12. let eventName = ModuleID + "HitCheck"
  13. EventSystem && EventSystem.on(eventName, ({x,y}) => {
  14. return true;
  15. });
  16. this.isTemplate = false
  17. //console.log("GEN EV: " , eventName, EventSystem);
  18. this._containerStyle = {
  19. marginLeft: 24,
  20. marginRight: 24
  21. }
  22. }
  23. setContainerStyle(style) {
  24. this._containerStyle = style;
  25. }
  26. display() {
  27. throw new Error("You must extend this base Module and override display method!");
  28. }
  29. render() {
  30. return <View ModuleID={this.props.ModuleID} style={[{overflow:'hidden'}]} MY_WRAPPER_FROM_BASE_MODULE={true}>
  31. {this.display()}
  32. </View>
  33. // throw new Error("You must extend this base Module and override render method!");
  34. }
  35. getProps() {
  36. return Resolver(this.constructor.Inputs, this.props);
  37. }
  38. }