Last active
December 21, 2023 13:39
-
-
Save sarinmsari/0ff3ccccc1e8ca38fdab2898d8612027 to your computer and use it in GitHub Desktop.
Add loading animation until iframe loads in react web app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Rsvp extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
loading: true | |
}; | |
} | |
hideSpinner = () => { | |
this.setState({ | |
loading: false | |
}); | |
}; | |
render() { | |
return ( | |
<div className="container rsvp-wrapper"> | |
{this.state.loading ? ( | |
<Spinner | |
className="loading text-center" | |
name="three-bounce" | |
color="white" | |
fadeIn="none" | |
/> | |
) : null} | |
<iframe | |
src="..." | |
width="100%" | |
height="700" | |
onLoad={this.hideSpinner} | |
frameBorder="0" | |
marginHeight="0" | |
marginWidth="0" | |
/> | |
</div> | |
); | |
} | |
} |
thank you
thank you
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank you! :)