UNPKG

@uimkit/uikit-react

Version:

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

33 lines (26 loc) 1.27 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); require('tslib'); var React = require('react'); require('../../../types/models.js'); require('../../../types/events.js'); require('../UIMomentContext.js'); function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } var React__default = /*#__PURE__*/_interopDefaultLegacy(React); var MomentContext = React__default["default"].createContext(undefined); var MomentProvider = function (_a) { var children = _a.children, value = _a.value; return (React__default["default"].createElement(MomentContext.Provider, { value: value }, children)); }; var useMomentContext = function (componentName) { var contextValue = React.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; }; exports.MomentContext = MomentContext; exports.MomentProvider = MomentProvider; exports.useMomentContext = useMomentContext; //# sourceMappingURL=MomentContext.js.map