Module.js 903 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. }
  19. componentWillMount() {
  20. }
  21. display() {
  22. throw new Error("You must extend this base Module and override display method!");
  23. }
  24. render() {
  25. return <View ModuleID={this.props.ModuleID} style={{}} MY_WRAPPER_FROM_BASE_MODULE={true}>
  26. {this.display()}
  27. </View>
  28. // throw new Error("You must extend this base Module and override render method!");
  29. }
  30. getProps() {
  31. return Resolver(this.constructor.Inputs, this.props);
  32. }
  33. }