35 lines
1.2 KiB
JavaScript
35 lines
1.2 KiB
JavaScript
'use strict';
|
|
|
|
exports.__esModule = true;
|
|
|
|
var _extends = Object.assign || 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; };
|
|
|
|
var _react = require('react');
|
|
|
|
var _setDisplayName = require('./setDisplayName');
|
|
|
|
var _setDisplayName2 = _interopRequireDefault(_setDisplayName);
|
|
|
|
var _wrapDisplayName = require('./wrapDisplayName');
|
|
|
|
var _wrapDisplayName2 = _interopRequireDefault(_wrapDisplayName);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
var getContext = function getContext(contextTypes) {
|
|
return function (BaseComponent) {
|
|
var factory = (0, _react.createFactory)(BaseComponent);
|
|
var GetContext = function GetContext(ownerProps, context) {
|
|
return factory(_extends({}, ownerProps, context));
|
|
};
|
|
|
|
GetContext.contextTypes = contextTypes;
|
|
|
|
if (process.env.NODE_ENV !== 'production') {
|
|
return (0, _setDisplayName2.default)((0, _wrapDisplayName2.default)(BaseComponent, 'getContext'))(GetContext);
|
|
}
|
|
return GetContext;
|
|
};
|
|
};
|
|
|
|
exports.default = getContext; |