Skip to content

Commit 11a6527

Browse files
committed
Update build, remove stray file
1 parent 5983b77 commit 11a6527

File tree

2 files changed

+17
-28
lines changed

2 files changed

+17
-28
lines changed

dist/index.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,18 @@ var _wrapStatelessFunction = require('./wrapStatelessFunction');
1515
var _wrapStatelessFunction2 = _interopRequireDefault(_wrapStatelessFunction);
1616

1717
var decoratorConstructor = undefined,
18-
functionConstructor = undefined;
18+
functionConstructor = undefined,
19+
isReactComponent = undefined;
20+
21+
/**
22+
* Determines if the given object has the signature of a class that inherits React.Component.
23+
*
24+
* @param {*} Component
25+
* @return {Boolean}
26+
*/
27+
isReactComponent = function (Component) {
28+
return 'prototype' in Component && typeof Component.prototype.render === 'function';
29+
};
1930

2031
/**
2132
* When used as a function.
@@ -28,7 +39,11 @@ var decoratorConstructor = undefined,
2839
functionConstructor = function (Component, defaultStyles, options) {
2940
var decoratedClass = undefined;
3041

31-
decoratedClass = Component.isReactClass ? (0, _extendReactClass2['default'])(Component, defaultStyles, options) : (0, _wrapStatelessFunction2['default'])(Component, defaultStyles, options);
42+
if (isReactComponent(Component)) {
43+
decoratedClass = (0, _extendReactClass2['default'])(Component, defaultStyles, options);
44+
} else {
45+
decoratedClass = (0, _wrapStatelessFunction2['default'])(Component, defaultStyles, options);
46+
}
3247

3348
if (Component.displayName) {
3449
decoratedClass.displayName = Component.displayName;

dist/utils.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)