import React, { Component } from 'react';
import PortalConsumer from './portal-consumer';
import PortalHost, { portal, PortalContext } from './portal-host';
export type PortalProps = {
/**
* 渲染到跟节点中的内容
*/
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` component to be rendered somewhere in the parent tree.
*
* ## Usage
* ```js
* import * as React from 'react';
* import { Text } from 'react-native';
* import { Portal } from '@fruits-chain/react-native-core';
*
* export default class MyComponent extends React.Component {
* render() {
* const { visible } = this.state;
* return (
*
* This is rendered at a different place
*
* );
* }
* }
* ```
* @deprecated 禁止使用,这种方式使用有缺陷
*/
class Portal extends Component {
static Host = PortalHost;
static add = portal.add;
static remove = portal.remove;
static update = portal.update;
render() {
const { children } = this.props;
return (
{(manager) => (
{children}
)}
);
}
}
export default Portal;