UNPKG

@adyen/react-native

Version:

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

56 lines (55 loc) 1.22 kB
"use strict"; import { useCallback } from 'react'; import PlatformPayView from '../specs/NativePlatformPayView'; import Styles from './common/Styles'; import { jsx as _jsx } from "react/jsx-runtime"; export const ApplePayButtonTheme = { WHITE: 1, WHITE_OUTLINE: 2, AUTOMATIC: 3, BLACK: 4 }; export const ApplePayButtonType = { BUY: 1, SETUP: 2, INSTORE: 3, DONATE: 4, CHECKOUT: 5, BOOK: 6, SUBSCRIBE: 7, RELOAD: 8, ADDMONEY: 9, TOPUP: 10, ORDER: 11, RENT: 12, SUPPORT: 13, CONTRIBUTE: 14, TIP: 15, CONTINUE: 16, PLAIN: 0 }; function getButtonTheme(type) { return ApplePayButtonTheme[type] ?? ApplePayButtonTheme.WHITE; } function getButtonType(type) { return ApplePayButtonType[type] ?? ApplePayButtonType.BUY; } export const ApplePayButton = ({ theme, type, radius, onPress, style }) => { const onPressHandler = useCallback(() => { onPress?.(); }, [onPress]); return /*#__PURE__*/_jsx(PlatformPayView, { theme: theme ? getButtonTheme(theme) : undefined, type: type ? getButtonType(type) : undefined, radius: radius, onButtonPress: onPressHandler, style: [Styles.defaultButton, style] }); }; //# sourceMappingURL=ApplePayButton.js.map