From da55354536c5d2a7d2ff58d3ffd69f16c87071d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ste=CC=81phane=20LaFle=CC=80che?= Date: Fri, 24 Jul 2020 11:22:10 -0400 Subject: [PATCH] Added optional component class prop --- README.md | 1 + src/RelativePortal.js | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0c9c629..108a0b1 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,7 @@ export default class RelativePortal extends React.Component { children: PropTypes.any.isRequired, // portal content onOutClick: PropTypes.func, // called when user click outside portal element component: PropTypes.string.isRequired, // dom tagName + componentClass: PropTypes.string, // dom class for tagName }; static defaultProps = { diff --git a/src/RelativePortal.js b/src/RelativePortal.js index 4b92a6e..d4c2e05 100644 --- a/src/RelativePortal.js +++ b/src/RelativePortal.js @@ -57,6 +57,7 @@ export default class RelativePortal extends React.Component { children: PropTypes.any, onOutClick: PropTypes.func, component: PropTypes.string.isRequired, + componentClass: PropTypes.string, }; static defaultProps = { @@ -98,7 +99,7 @@ export default class RelativePortal extends React.Component { } render() { - const { component: Comp, top, left, right, fullWidth, ...props } = this.props; + const { component: Comp, top, left, right, fullWidth, componentClass, ...props } = this.props; const fromLeftOrRight = right !== undefined ? { right: this.state.right + right } : @@ -109,6 +110,7 @@ export default class RelativePortal extends React.Component { return ( { this.element = element; }}