Closed fifyrio closed 6 years ago
@fifyrio as it's implemented now, this library won't support it, but if you simply copy the contents of https://github.com/svenanders/react-iframe/blob/master/index.js to your project, you can add support for onLoad. That's what I did, here's the code.
const Iframe = class extends PureComponent {
render() {
const props = {
ref: 'iframe',
frameBorder: '0',
src: this.props.url,
target: '_parent',
allowFullScreen: this.props.allowFullScreen || false,
style: Object.assign(
{
position: this.props.position || 'absolute',
display: this.props.display || 'block',
height: this.props.height || '100%',
width: this.props.width || '100%',
},
this.props.styles || {},
),
height: this.props.height || '100%',
name: this.props.name || '',
width: this.props.width || '100%',
onLoad: this.props.onLoad ? this.props.onLoad : undefined,
}
const { id, className } = this.props
return React.createElement(
'iframe',
Object.assign(props, id ? id : null, className ? className : null),
)
}
}
Thanks
With the merge and release of PR #24 this is now supported.
Hi, buddy, how to get onload event?