@ant-design/react-native
Version:
基于蚂蚁金服移动设计规范的 React Native 组件库
38 lines (37 loc) • 1.1 kB
TypeScript
import React from 'react';
import PortalHost from './portal-host';
export type PortalProps = {
/**
* Content of the `Portal`.
*/
children?: React.ReactNode;
};
/**
* Portal allows to render a component at a different place in the parent tree.
* You can use it to render content which should appear above other elements, similar to `Modal`.
* It requires a [`Portal.Host`](portal-host.html) component to be rendered somewhere in the parent tree.
*
* ## Usage
* ```js
* import * as React from 'react';
* import { Portal, Text } from '@ant-design/react-native';
*
* export default class MyComponent extends React.Component {
* render() {
* const { visible } = this.state;
* return (
* <Portal>
* <Text>This is rendered at a different place</Text>
* </Portal>
* );
* }
* }
* ```
*/
declare class Portal extends React.Component<PortalProps> {
static Host: typeof PortalHost;
static add: (e: React.ReactNode) => number;
static remove: (key: number) => void;
render(): React.JSX.Element;
}
export default Portal;