UNPKG

@shopify/app-bridge-host

Version:

App Bridge Host contains middleware and components that are meant to be consumed by the app's host. The middleware and `Frame` component are responsible for facilitating messages posted between the client and host, and used to act on actions sent from the

33 lines (32 loc) 1.1 kB
import React, { CSSProperties } from 'react'; import { Application } from './'; import { Context } from '@shopify/app-bridge'; export interface FrameProps { app: Application; title: string; url: string; [key: string]: any; style?: CSSProperties; context: Context; /** The handler called when the `url` prop changes*/ onUrlChange?: (iframe: HTMLIFrameElement, newUrl: string) => void; } /** * Renders an iframe and sets up a `MessageTransport` between * the iframe and the parent window * @public * @remarks The iframe is never updated to prevent duplicated browser history entries * When a new url is received the `onUrlChange` is called with the iframe and the new url * */ export default class Frame extends React.Component<FrameProps, never> { iframe?: HTMLIFrameElement; detach?: Function; static defaultProps: { context: Context; }; shouldComponentUpdate(): boolean; componentDidMount(): void; componentWillUnmount(): void; UNSAFE_componentWillReceiveProps(nextProps: FrameProps): void; render(): JSX.Element; }