MCPcopy Index your code
hub / github.com/ryanseddon/react-frame-component / renderFrameContents

Method renderFrameContents

src/Frame.jsx:115–157  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

113 }, 500);
114
115 renderFrameContents() {
116 if (!this._isMounted) {
117 return null;
118 }
119
120 const doc = this.getDoc();
121
122 if (!doc) {
123 return null;
124 }
125
126 const contentDidMount = this.props.contentDidMount;
127 const contentDidUpdate = this.props.contentDidUpdate;
128
129 const win = doc.defaultView || doc.parentView;
130 const contents = (
131 <Content
132 contentDidMount={contentDidMount}
133 contentDidUpdate={contentDidUpdate}
134 >
135 <FrameContextProvider value={{ document: doc, window: win }}>
136 <div className="frame-content">{this.props.children}</div>
137 </FrameContextProvider>
138 </Content>
139 );
140
141 if (this.props.dangerouslyUseDocWrite && doc.body.children.length < 1) {
142 doc.open('text/html', 'replace');
143 doc.write(this.props.initialContent);
144 doc.close();
145 }
146
147 const mountTarget = this.getMountTarget();
148
149 if (!mountTarget) {
150 return null;
151 }
152
153 return [
154 ReactDOM.createPortal(this.props.head, this.getDoc().head),
155 ReactDOM.createPortal(contents, mountTarget)
156 ];
157 }
158
159 render() {
160 const props = {

Callers 1

renderMethod · 0.95

Calls 2

getDocMethod · 0.95
getMountTargetMethod · 0.95

Tested by

no test coverage detected