Skip to content

Commit 7d3bb6a

Browse files
committed
Allow a React class component to be used as a placeholder
1 parent 2ba5e6c commit 7d3bb6a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/components/PlaceholderWithoutTracking.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class PlaceholderWithoutTracking extends React.Component {
6060
render() {
6161
const { className, height, placeholder, style, width } = this.props;
6262

63-
if (placeholder) {
63+
if (placeholder && placeholder.hasOwnProperty('getBoundingClientRect')) {
6464
return React.cloneElement(placeholder,
6565
{ ref: el => this.placeholder = el });
6666
}
@@ -69,6 +69,7 @@ class PlaceholderWithoutTracking extends React.Component {
6969
<span className={className}
7070
ref={el => this.placeholder = el}
7171
style={{ display: 'inline-block', height, width, ...style }}>
72+
{placeholder}
7273
</span>
7374
);
7475
}

0 commit comments

Comments
 (0)