UNPKG

1.2 kBTypeScriptView Raw
1import React, { CSSProperties } from 'react';
2import { Context } from '@shopify/app-bridge';
3import { Application } from '.';
4export interface FrameProps {
5 app: Application;
6 title: string;
7 url: string;
8 [key: string]: any;
9 style?: CSSProperties;
10 context: Context;
11 /** The handler called when the `url` prop changes*/
12 onUrlChange?: (iframe: HTMLIFrameElement, newUrl: string) => void;
13 /** The handler called to set a reference to this class*/
14 onInit?: (frame: Frame) => void;
15}
16/**
17 * Renders an iframe and sets up a `MessageTransport` between
18 * the iframe and the parent window
19 * @public
20 * @remarks The iframe is never updated to prevent duplicated browser history entries
21 * When a new url is received the `onUrlChange` is called with the iframe and the new url
22 * */
23export default class Frame extends React.Component<FrameProps, never> {
24 iframe?: HTMLIFrameElement;
25 detach?: Function;
26 src: string;
27 static defaultProps: {
28 context: Context;
29 };
30 constructor(props: FrameProps);
31 componentDidMount(): void;
32 componentWillUnmount(): void;
33 componentDidUpdate(prevProps: FrameProps): void;
34 render(): JSX.Element;
35}