3
0

Module.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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: 12,
  20. marginRight: 12,
  21. }
  22. }
  23. componentWillMount() {
  24. }
  25. setContainerStyle(style) {
  26. this._containerStyle = style;
  27. }
  28. display() {
  29. throw new Error("You must extend this base Module and override display method!");
  30. }
  31. render() {
  32. return <View ModuleID={this.props.ModuleID} style={[{overflow:'hidden'},this._containerStyle]} MY_WRAPPER_FROM_BASE_MODULE={true}>
  33. {this.display()}
  34. </View>
  35. // throw new Error("You must extend this base Module and override render method!");
  36. }
  37. getProps() {
  38. return Resolver(this.constructor.Inputs, this.props);
  39. }
  40. }