UNPKG

1.33 kBTypeScriptView Raw
1import * as React from 'react';
2declare type Props = {
3 children: React.ReactNode;
4};
5export declare type PortalMethods = {
6 mount: (children: React.ReactNode) => number;
7 update: (key: number, children: React.ReactNode) => void;
8 unmount: (key: number) => void;
9};
10export declare const PortalContext: React.Context<PortalMethods>;
11/**
12 * Portal host renders all of its children `Portal` elements.
13 * For example, you can wrap a screen in `Portal.Host` to render items above the screen.
14 * If you're using the `Provider` component, it already includes `Portal.Host`.
15 *
16 * ## Usage
17 * ```js
18 * import * as React from 'react';
19 * import { Text } from 'react-native';
20 * import { Portal } from 'react-native-paper';
21 *
22 * const MyComponent = () => (
23 * <Portal.Host>
24 * <Text>Content of the app</Text>
25 * </Portal.Host>
26 * );
27 *
28 * export default MyComponent;
29 * ```
30 *
31 * Here any `Portal` elements under `<App />` are rendered alongside `<App />` and will appear above `<App />` like a `Modal`.
32 */
33export default class PortalHost extends React.Component<Props> {
34 static displayName: string;
35 componentDidMount(): void;
36 private setManager;
37 private mount;
38 private update;
39 private unmount;
40 private nextKey;
41 private queue;
42 private manager;
43 render(): JSX.Element;
44}
45export {};