3
0

Module.js 1.0 KB

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