@@ -66,8 +66,8 @@ const popupWrapper = styled(BaseWrapper)`
66
66
${ ( { size } ) =>
67
67
size &&
68
68
`
69
- height: calc(${ size } % - 80px);
70
- width: calc(${ size } % - 80px);
69
+ height: calc(${ size } % - 80px);
70
+ width: calc(${ size } % - 80px);
71
71
` }
72
72
transition: all 300ms ease-out;
73
73
`
@@ -258,17 +258,20 @@ class Popup extends Component {
258
258
}
259
259
260
260
handleIframeLoad ( iframeRef ) {
261
- this . setState ( { iframeLoaded : true } , ( ) => {
262
- setTimeout ( ( ) => {
263
- if ( this . state . isLoading ) {
264
- this . updateIcon ( < IconCloseImage alt = "close-typeform" data-qa = "popup-close-button" src = { closeImg } /> )
265
- this . handleSidePanelOpen ( )
266
- this . setState ( { frameAnimate : true , isLoading : false } )
267
- if ( iframeRef && iframeRef . contentWindow ) {
268
- iframeRef . contentWindow . focus ( )
261
+ return new Promise ( ( resolve ) => {
262
+ this . setState ( { iframeLoaded : true } , ( ) => {
263
+ setTimeout ( ( ) => {
264
+ if ( this . state . isLoading ) {
265
+ this . updateIcon ( < IconCloseImage alt = "close-typeform" data-qa = "popup-close-button" src = { closeImg } /> )
266
+ this . handleSidePanelOpen ( )
267
+ this . setState ( { frameAnimate : true , isLoading : false } )
268
+ if ( iframeRef && iframeRef . contentWindow ) {
269
+ iframeRef . contentWindow . focus ( )
270
+ }
269
271
}
270
- }
271
- } , 500 )
272
+ resolve ( )
273
+ } , 500 )
274
+ } )
272
275
} )
273
276
}
274
277
0 commit comments