import React, { FC, useEffect, useRef } from 'react'; import createIframe from '../../utils/iframe/iframe'; import { MiniAppView } from '../../model/miniAppView'; // type Props = IframeHTMLAttributes; interface Props { view: MiniAppView; sandboxAttributes?: Array; className?: string; } const Frame: FC = (props: Props) => { const { className, view, sandboxAttributes } = props; const divRef = useRef(null); useEffect(() => { // const el = document.getElementById('iframe-holder'); const iframe = createIframe({ el: divRef.current, sandboxAttributes }); iframe.setProps({ view, className }); }, [className, view, sandboxAttributes]); return
; }; const defautlSandboxAttributes = [ 'allow-modals', 'allow-forms', 'allow-pointer-lock', 'allow-popups', 'allow-same-origin', 'allow-scripts', ]; Frame.defaultProps = { sandboxAttributes: defautlSandboxAttributes, }; export default Frame;