From 262077afdab1cc03d15f43559396a99d0c703691 Mon Sep 17 00:00:00 2001 From: wotsyula <wotsyula@gmail.com> Date: Tue, 13 Feb 2018 22:56:34 +0300 Subject: [PATCH] Update themr.js Allows for theming of HOC and components without a function name. Since HOC have different function name than original, we should check for `displayName` 1st and fall back to `Component` for nameless components. --- src/components/themr.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/themr.js b/src/components/themr.js index e19711f..0acae2b 100644 --- a/src/components/themr.js +++ b/src/components/themr.js @@ -54,7 +54,7 @@ export default (componentName, localTheme, options = {}) => (ThemedComponent) => * @property {{wrappedInstance: *}} refs */ class Themed extends Component { - static displayName = `Themed${ThemedComponent.name}`; + static displayName = `Themed${(ThemedComponent.displayName || ThemedComponent.name || "Component")}`; static contextTypes = { themr: PropTypes.object