@@ -118,11 +118,24 @@ class PlaceholderWithoutTracking extends React.Component {
118
118
} ) ;
119
119
}
120
120
121
+ const styleProp = {
122
+ display : 'inline-block' ,
123
+ ...style ,
124
+ } ;
125
+
126
+ if ( typeof width !== 'undefined' ) {
127
+ styleProp . width = width ;
128
+ }
129
+
130
+ if ( typeof height !== 'undefined' ) {
131
+ styleProp . height = height ;
132
+ }
133
+
121
134
return (
122
135
< span
123
136
className = { className }
124
137
ref = { el => ( this . placeholder = el ) }
125
- style = { { display : 'inline-block' , height , width , ... style } }
138
+ style = { styleProp }
126
139
>
127
140
{ placeholder }
128
141
</ span >
@@ -133,24 +146,22 @@ class PlaceholderWithoutTracking extends React.Component {
133
146
PlaceholderWithoutTracking . propTypes = {
134
147
onVisible : PropTypes . func . isRequired ,
135
148
className : PropTypes . string ,
136
- height : PropTypes . number ,
149
+ height : PropTypes . oneOfType ( [ PropTypes . number , PropTypes . string ] ) ,
137
150
placeholder : PropTypes . element ,
138
151
threshold : PropTypes . number ,
139
152
useIntersectionObserver : PropTypes . bool ,
140
153
scrollPosition : PropTypes . shape ( {
141
154
x : PropTypes . number . isRequired ,
142
155
y : PropTypes . number . isRequired ,
143
156
} ) ,
144
- width : PropTypes . number ,
157
+ width : PropTypes . oneOfType ( [ PropTypes . number , PropTypes . string ] ) ,
145
158
} ;
146
159
147
160
PlaceholderWithoutTracking . defaultProps = {
148
161
className : '' ,
149
- height : 0 ,
150
162
placeholder : null ,
151
163
threshold : 100 ,
152
164
useIntersectionObserver : true ,
153
- width : 0 ,
154
165
} ;
155
166
156
167
export default PlaceholderWithoutTracking ;
0 commit comments