avg-core-ts
Version:
Develop Adventure Game (or ADV, Visual Novel, Galgame, etc.) on your own!
36 lines (30 loc) • 1.08 kB
JavaScript
/**
* @file General image component
* @author MicroMatrix <yangpan.1985@bytedance.com>
* @copyright 2012-2020 bytedance
* @link git@code.byted.org:yangpan.1985/avg.git
*/
import upperFirst from 'lodash/upperFirst';
import React from 'react';
// import PropTypes from 'prop-types';
import createComponent from 'components/createComponent';
import ContainerMixin from 'components/ContainerMixin';
import NodeMixin from 'components/NodeMixin';
// import pixiPropTypes from './propTypes';
export default function componentify(name, lifeCycle) {
const compName = upperFirst(name);
const Raw = createComponent(`Raw${compName}`, ContainerMixin, NodeMixin, lifeCycle);
class Component extends React.PureComponent {
static displayName = compName;
// static propTypes = {
// file: PropTypes.string,
// dataUri: PropTypes.string,
// rect: PropTypes.arrayOf(PropTypes.number),
// ...pixiPropTypes,
// };
render() {
return React.createElement(Raw, this.props, this.props.children);
}
}
return Component;
}