UNPKG

@adyen/react-native

Version:

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

30 lines 861 B
import { Event } from '../core/constants'; /** * Wrapper for all Native Modules that do not support Action handling. * */ export class ComponentWrapper { constructor(nativeModule, events) { this.nativeModule = nativeModule; this.events = [Event.onError, Event.onSubmit, Event.onComplete]; events?.forEach(element => this.events.push(element)); } addListener(eventType) { this.nativeModule.addListener(eventType); } removeListeners(count) { this.nativeModule.removeListeners(count); } open(paymentMethods, configuration) { this.nativeModule.open(paymentMethods, configuration); } hide(success, option) { if (option?.message) { this.nativeModule.hide(success, option); } else { this.nativeModule.hide(success, { message: '' }); } } } //# sourceMappingURL=ComponentWrapper.js.map