@@ -118,11 +118,24 @@ class PlaceholderWithoutTracking extends React.Component {
118118 } ) ;
119119 }
120120
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+
121134 return (
122135 < span
123136 className = { className }
124137 ref = { el => ( this . placeholder = el ) }
125- style = { { display : 'inline-block' , height , width , ... style } }
138+ style = { styleProp }
126139 >
127140 { placeholder }
128141 </ span >
@@ -133,24 +146,22 @@ class PlaceholderWithoutTracking extends React.Component {
133146PlaceholderWithoutTracking . propTypes = {
134147 onVisible : PropTypes . func . isRequired ,
135148 className : PropTypes . string ,
136- height : PropTypes . number ,
149+ height : PropTypes . oneOfType ( [ PropTypes . number , PropTypes . string ] ) ,
137150 placeholder : PropTypes . element ,
138151 threshold : PropTypes . number ,
139152 useIntersectionObserver : PropTypes . bool ,
140153 scrollPosition : PropTypes . shape ( {
141154 x : PropTypes . number . isRequired ,
142155 y : PropTypes . number . isRequired ,
143156 } ) ,
144- width : PropTypes . number ,
157+ width : PropTypes . oneOfType ( [ PropTypes . number , PropTypes . string ] ) ,
145158} ;
146159
147160PlaceholderWithoutTracking . defaultProps = {
148161 className : '' ,
149- height : 0 ,
150162 placeholder : null ,
151163 threshold : 100 ,
152164 useIntersectionObserver : true ,
153- width : 0 ,
154165} ;
155166
156167export default PlaceholderWithoutTracking ;
0 commit comments