UNPKG

@uimkit/uikit-react

Version:

<img style="width:64px" src="https://mgmt.uimkit.chat/media/img/avatar.png"/>

23 lines (20 loc) 936 B
import 'tslib'; import React__default, { useContext } from 'react'; import '../../../types/models.js'; import '../../../types/events.js'; import '../UIMomentContext.js'; var MomentContext = React__default.createContext(undefined); var MomentProvider = function (_a) { var children = _a.children, value = _a.value; return (React__default.createElement(MomentContext.Provider, { value: value }, children)); }; var useMomentContext = function (componentName) { var contextValue = useContext(MomentContext); if (!contextValue) { console.warn("The useMomentContext hook was called outside of the MomentContext provider. Make sure this hook is called within the Moment's UI component. The errored call is located in the ".concat(componentName, " component.")); return {}; } return contextValue; }; export { MomentContext, MomentProvider, useMomentContext }; //# sourceMappingURL=MomentContext.js.map