@adyen/react-native
Version:
Wraps Adyen Checkout Drop-In and Components for iOS and Android for convenient use with React Native
30 lines • 855 B
JavaScript
import { Event } from '../core/constants';
/**
* Wrapper for all Native Modules that do not support Action handling.
* */
export class ComponentWrapper {
constructor(prop) {
this.nativeModule = prop.nativeModule;
this.events = [Event.onError, Event.onSubmit, Event.onComplete];
prop.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