Skip to content

Commit 262077a

Browse files
authored
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.
1 parent 8d12cfd commit 262077a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/components/themr.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export default (componentName, localTheme, options = {}) => (ThemedComponent) =>
5454
* @property {{wrappedInstance: *}} refs
5555
*/
5656
class Themed extends Component {
57-
static displayName = `Themed${ThemedComponent.name}`;
57+
static displayName = `Themed${(ThemedComponent.displayName || ThemedComponent.name || "Component")}`;
5858

5959
static contextTypes = {
6060
themr: PropTypes.object

0 commit comments

Comments
 (0)