@shopify/app-bridge-host
Version:
App Bridge Host contains components and middleware to be consumed by the app's host, as well as the host itself. The middleware and `Frame` component are responsible for facilitating communication between the client and host, and used to act on actions se
36 lines (35 loc) • 1.22 kB
TypeScript
import React, { CSSProperties } from 'react';
import { Context } from '@shopify/app-bridge-core';
import type { Application } from './types';
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;
/** The handler called to set a reference to this class*/
onInit?: (frame: Frame) => 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> {
static defaultProps: {
context: Context;
};
iframe?: HTMLIFrameElement;
detach?: Function;
src: string;
constructor(props: FrameProps);
componentDidMount(): void;
componentWillUnmount(): void;
componentDidUpdate(prevProps: FrameProps): void;
render(): React.JSX.Element;
}