UNPKG

@adyen/react-native

Version:

Wraps Adyen Checkout Drop-In and Components for iOS and Android for convenient use with React Native

27 lines (24 loc) 848 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useComponent = exports.AdyenComponentContext = void 0; var _react = require("react"); var _constants = require("./constants"); /** * Context for embedded components to subscribe/unsubscribe to MessageBus events. */ const AdyenComponentContext = exports.AdyenComponentContext = /*#__PURE__*/(0, _react.createContext)(null); /** * Hook to access the AdyenComponentContext for subscribing/unsubscribing to MessageBus events. * Must be used within an AdyenCheckout provider. */ const useComponent = () => { const context = (0, _react.useContext)(AdyenComponentContext); if (!context) { throw new Error(_constants.COMPONENT_MISSING_CONTEXT_ERROR); } return context; }; exports.useComponent = useComponent; //# sourceMappingURL=useComponent.js.map