react-native-multiple-modals
Version:
Native implementation with the ability to display multiple Modals
30 lines (28 loc) • 1.17 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.LayoutInspectorProvider = void 0;
var _react = require("react");
var _AppContainer = _interopRequireDefault(require("react-native/Libraries/ReactNative/AppContainer"));
var _RootTag = require("react-native/Libraries/ReactNative/RootTag");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
// Wrap the children in AppContainer so the React Native inspector works
// within the modal. See https://github.com/facebook/react-native/blob/v0.81.4/packages/react-native/Libraries/Modal/Modal.js#L308
// for the inspiration within the RN Modal component.
const LayoutInspectorProvider = ({
children
}) => {
const rootTag = (0, _react.useContext)(_RootTag.RootTagContext);
// The inspector is only needed in development
if (!__DEV__) {
return children;
}
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_AppContainer.default, {
rootTag: rootTag,
children: children
});
};
exports.LayoutInspectorProvider = LayoutInspectorProvider;
//# sourceMappingURL=LayoutInspectorProvider.js.map