UNPKG

@adyen/react-native

Version:

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

23 lines (19 loc) 673 B
"use strict"; import { createContext, useContext } from 'react'; import { COMPONENT_MISSING_CONTEXT_ERROR } from './constants'; /** * Context for embedded components to subscribe/unsubscribe to MessageBus events. */ export const AdyenComponentContext = /*#__PURE__*/createContext(null); /** * Hook to access the AdyenComponentContext for subscribing/unsubscribing to MessageBus events. * Must be used within an AdyenCheckout provider. */ export const useComponent = () => { const context = useContext(AdyenComponentContext); if (!context) { throw new Error(COMPONENT_MISSING_CONTEXT_ERROR); } return context; }; //# sourceMappingURL=useComponent.js.map