@storybook/addon-ondevice-controls
Version:
Display storybook controls on your device.
21 lines (20 loc) • 771 B
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { Portal } from '@gorhom/portal';
import { Modal, Platform, View } from 'react-native';
const modalSupported = Platform.OS !== 'macos';
export const ModalPortal = ({ children, visible, usePortal, ...props }) => {
if (modalSupported && !usePortal) {
return (_jsx(Modal, { visible: visible, ...props, children: children }));
}
if (!visible)
return null;
return (_jsx(Portal, { hostName: "storybook-lite-ui-root", children: _jsx(View, { style: {
flex: 1,
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
zIndex: 1000,
}, children: children }) }));
};