Skip to content

Commit 44cac8d

Browse files
authored
Modifiers - add getComponentName (#3800)
* Modifiers - add getComponentName * Call getComponentName with call
1 parent 8185baf commit 44cac8d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/commons/modifiers.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,11 +359,15 @@ export function extractComponentProps(component: any, props: Dictionary<any>, ig
359359
return componentProps;
360360
}
361361

362+
export function getComponentName(componentDisplayName: string) {
363+
//@ts-ignore
364+
return componentDisplayName || this.displayName || this.constructor.displayName || this.constructor.name;
365+
}
366+
362367
//@ts-ignore
363368
export function getThemeProps<T extends object>(props: T = this.props, context = this.context, componentDisplayName = ''): T {
364-
const componentName =
365-
//@ts-ignore
366-
componentDisplayName || this.displayName || this.constructor.displayName || this.constructor.name;
369+
//@ts-ignore
370+
const componentName = getComponentName.call(this, componentDisplayName);
367371

368372
let themeProps;
369373
if (_.isFunction(ThemeManager.components[componentName])) {

0 commit comments

Comments
 (0)