(props)
| 21 | |
| 22 | // $FlowFixMe[missing-local-annot] |
| 23 | function Frame(props) { |
| 24 | const [element, setElement] = React.useState(null); |
| 25 | |
| 26 | const ref = React.useRef(); |
| 27 | |
| 28 | React.useLayoutEffect(function () { |
| 29 | const iframe = ref.current; |
| 30 | |
| 31 | if (iframe) { |
| 32 | const html = ` |
| 33 | <!DOCTYPE html> |
| 34 | <html> |
| 35 | <body> |
| 36 | <div id="root"></div> |
| 37 | </body> |
| 38 | </html> |
| 39 | `; |
| 40 | |
| 41 | const document = iframe.contentDocument; |
| 42 | |
| 43 | document.open(); |
| 44 | document.write(html); |
| 45 | document.close(); |
| 46 | |
| 47 | setElement(document.getElementById('root')); |
| 48 | } |
| 49 | }, []); |
| 50 | |
| 51 | return ( |
| 52 | <Fragment> |
| 53 | <iframe title="Test Iframe" ref={ref} style={iframeStyle} /> |
| 54 | <iframe |
| 55 | title="Secured Iframe" |
| 56 | src="https://example.com" |
| 57 | style={iframeStyle} |
| 58 | /> |
| 59 | |
| 60 | {element ? createPortal(props.children, element) : null} |
| 61 | </Fragment> |
| 62 | ); |
| 63 | } |
| 64 | |
| 65 | function Greeting() { |
| 66 | return ( |
nothing calls this directly
no test coverage detected