diff --git a/scm-ui-components/packages/ui-components/src/layout/Page.js b/scm-ui-components/packages/ui-components/src/layout/Page.js index 403bae91e6..622c4b429c 100644 --- a/scm-ui-components/packages/ui-components/src/layout/Page.js +++ b/scm-ui-components/packages/ui-components/src/layout/Page.js @@ -44,6 +44,11 @@ class Page extends React.Component { ); } + isPageAction(node: any) { + return node.displayName === PageActions.displayName + || (node.type && node.type.displayName === PageActions.displayName); + } + renderPageHeader() { const { error, title, subtitle, children, classes } = this.props; @@ -51,7 +56,7 @@ class Page extends React.Component { let pageActionsExists = false; React.Children.forEach(children, child => { if (child && !error) { - if (child.type.name === PageActions.name) { + if (this.isPageAction(child)) { pageActions = (
{ let content = []; React.Children.forEach(children, child => { if (child) { - if (child.type.name !== PageActions.name) { + if (!this.isPageAction(child)) { content.push(child); } } diff --git a/scm-ui-components/packages/ui-components/src/layout/PageActions.js b/scm-ui-components/packages/ui-components/src/layout/PageActions.js index eb055a5605..98f0a21634 100644 --- a/scm-ui-components/packages/ui-components/src/layout/PageActions.js +++ b/scm-ui-components/packages/ui-components/src/layout/PageActions.js @@ -8,7 +8,9 @@ type Props = { children: React.Node }; -class PageActions extends React.Component { +export default class PageActions extends React.Component { + static displayName = "PageActions"; + render() { return <>{this.renderContent()}; } @@ -24,5 +26,3 @@ class PageActions extends React.Component { return children; } } - -export default PageActions;