UNPKG

@equinor/mad-core

Version:

Core library for the Mobile App Delivery team

17 lines (15 loc) 674 B
// src/components/CoreNavigatorTypeProvider.tsx import React, { createContext, useContext } from "react"; var CoreNavigatorTypeContext = createContext(null); var CoreNavigatorTypeProvider = ({ type, children }) => { return /* @__PURE__ */ React.createElement(CoreNavigatorTypeContext.Provider, { value: type }, children); }; var useCoreNavigatorType = () => { const coreNavigatorType = useContext(CoreNavigatorTypeContext); if (!coreNavigatorType) throw new Error("Could not find core navigator type. You have most likely not added a core navigator to your application"); return coreNavigatorType; }; export { CoreNavigatorTypeProvider, useCoreNavigatorType };