Module.js 877 B

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