Skip to content

Releases: ryanseddon/react-frame-component

v5.2.0

02 Dec 03:23
Compare
Choose a tag to compare

Forwarding iframe ref

Allow to pass ref prop to Frame component which will allow to reach the inner iframe HTMLIFrameElement.
The ref forwarding is done by React.forwardRef helper which wraps the original Frame class component instance.

  • Forward iframe ref and use React.createRef (#189) b68a2f2

Example usage:

function Foo() {
  const iframeRef = React.useRef()

  React.useEffect(() => {
    iframeRef.style.setProperty('background-color', 'pink');
  }, [])

  <Frame ref={iframeRef} />
}

Other changes

v5.1.0...v5.2.0

5.1.0

16 Jun 01:14
Compare
Choose a tag to compare

Adds new useFrame hook for access to iframes window and document host objects without the need for the context render prop pattern.

import { useFrame } from 'react-frame-component';

function Foo (props) {
  const { window, document } = useFrame();

  /* rest of the component */
}

v5.0.1...v5.1.0

5.0.1

11 Jun 01:00
Compare
Choose a tag to compare

Adds index.ts file to declare module for Typescript

v5.0.0...v5.0.1

Switch from doc.write to srcDoc

20 Apr 04:03
Compare
Choose a tag to compare

This is a breaking change

This library now uses srcDoc which means no support for IE11 in v5 if you need IE11 support you can continue to use v4.1.3.

srcDoc is also async vs doc.write being sync, this will mostly go unnoticed in most use cases. However if you're relying on this library in unit tests you may need to convert those test to async aware tests. This means you'll need to use the done callback in most unit test frameworks.

Why the change?

document.write is now bad practice for performance reasons and will be flagged accordingly in various web perf testing tools, srcDoc is a viable alternative without the perf downsides.

Commits

v4.1.3...v5.0.0

v5.0.0-alpha.0

04 Nov 22:10
Compare
Choose a tag to compare
v5.0.0-alpha.0 Pre-release
Pre-release

This pre-release is testing whether srcdoc usage over doc.write() is a better move going forward. It's a breaking change as srcdoc is async.

By changing to srcdoc this will drop support for IE11.