Home / Class/ IframePortal Class — react Architecture

IframePortal Class — react Architecture

Architecture documentation for the IframePortal class in Iframe.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  e98a877d_4716_e0c7_7c4d_089bac92fd33["IframePortal"]
  70b5253e_813d_8b9b_6dca_779425403139["Iframe.js"]
  e98a877d_4716_e0c7_7c4d_089bac92fd33 -->|defined in| 70b5253e_813d_8b9b_6dca_779425403139
  c0ee5f36_53e8_c70b_2bb1_2c118557f22a["render()"]
  e98a877d_4716_e0c7_7c4d_089bac92fd33 -->|method| c0ee5f36_53e8_c70b_2bb1_2c118557f22a

Relationship Graph

Source Code

fixtures/dom/src/components/Iframe.js lines 4–43

class IframePortal extends React.Component {
  iframeRef = null;

  handleRef = ref => {
    if (ref !== this.iframeRef) {
      this.iframeRef = ref;
      if (ref) {
        if (ref.contentDocument && this.props.head) {
          ref.contentDocument.head.innerHTML = this.props.head;
        }
        // Re-render must take place in the next tick (Firefox)
        setTimeout(() => {
          this.forceUpdate();
        });
      }
    }
  };

  render() {
    const ref = this.iframeRef;
    let portal = null;
    if (ref && ref.contentDocument) {
      portal = ReactDOM.createPortal(
        this.props.children,
        ref.contentDocument.body
      );
    }

    return (
      <div>
        <iframe
          title="Iframe portal"
          style={{border: 'none', height: this.props.height}}
          ref={this.handleRef}
        />
        {portal}
      </div>
    );
  }
}

Domain

Frequently Asked Questions

What is the IframePortal class?
IframePortal is a class in the react codebase, defined in fixtures/dom/src/components/Iframe.js.
Where is IframePortal defined?
IframePortal is defined in fixtures/dom/src/components/Iframe.js at line 4.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free