@hyext-beyond/hy-ui-native
Version:
A native lib polyfill for huya miniapp
34 lines • 1.81 kB
JavaScript
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
import React, { Component } from "react";
export var createAnimated = function createAnimated(NativeComponent) {
var _VideoAnimated;
return _VideoAnimated = /*#__PURE__*/function (_Component) {
_inheritsLoose(VideoAnimated, _Component);
function VideoAnimated() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
_this._nativeAnimated = null;
return _this;
}
var _proto = VideoAnimated.prototype;
_proto.render = function render() {
var _this2 = this;
return /*#__PURE__*/React.createElement(NativeComponent, _extends({
ref: function ref(c) {
_this2._nativeAnimated = c;
}
}, this.props));
};
return VideoAnimated;
}(Component), _VideoAnimated.defaultProps = {
loop: false,
onEnd: function onEnd() {},
onStart: function onStart() {},
onError: function onError() {}
}, _VideoAnimated;
};