GithubHelp home page GithubHelp logo

Comments (3)

rm-rf-etc avatar rm-rf-etc commented on July 20, 2024

@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),
		)
	}
}

from react-iframe.

fifyrio avatar fifyrio commented on July 20, 2024

Thanks

from react-iframe.

foxmicha avatar foxmicha commented on July 20, 2024

With the merge and release of PR #24 this is now supported.

from react-iframe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.