(Component: Function, defaultStyles: Object, options: TypeOptions)
| 19 | * When used as a function. |
| 20 | */ |
| 21 | const functionConstructor = (Component: Function, defaultStyles: Object, options: TypeOptions): Function => { |
| 22 | let decoratedClass; |
| 23 | |
| 24 | const configuration = makeConfiguration(options); |
| 25 | |
| 26 | if (isReactComponent(Component)) { |
| 27 | decoratedClass = extendReactClass(Component, defaultStyles, configuration); |
| 28 | } else { |
| 29 | decoratedClass = wrapStatelessFunction(Component, defaultStyles, configuration); |
| 30 | } |
| 31 | |
| 32 | if (Component.displayName) { |
| 33 | decoratedClass.displayName = Component.displayName; |
| 34 | } else { |
| 35 | decoratedClass.displayName = Component.name; |
| 36 | } |
| 37 | |
| 38 | return decoratedClass; |
| 39 | }; |
| 40 | |
| 41 | /** |
| 42 | * When used as a ES7 decorator. |
no test coverage detected