UNPKG

react95-native

Version:

Refreshed Windows 95 style UI components for your React Native app

38 lines (36 loc) 1.16 kB
import React from 'react'; import PortalConsumer from './PortalConsumer'; import PortalHost, { PortalContext } from './PortalHost'; import { ThemeProvider, withTheme } from '../../core/theming'; /** * 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 'react-native-paper'; * * const MyComponent = () => ( * <Portal> * <Text>This is rendered at a different place</Text> * </Portal> * ); * * export default MyComponent; * ``` */ const Portal = ({ children, theme }) => { return /*#__PURE__*/React.createElement(PortalContext.Consumer, null, manager => /*#__PURE__*/React.createElement(PortalConsumer, { manager: manager }, /*#__PURE__*/React.createElement(ThemeProvider, { theme: theme }, children))); }; Portal.Host = PortalHost; export default withTheme(Portal); //# sourceMappingURL=Portal.js.map