3
0

Module.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. this._containerStyle = {
  18. margin: 10
  19. }
  20. }
  21. componentWillMount() {
  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'},this._containerStyle]} 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. }