@adyen/react-native
Version:
Wraps Adyen Checkout Drop-In and Components for iOS and Android for convenient use with React Native
45 lines (44 loc) • 1.06 kB
JavaScript
;
import { useCallback } from 'react';
import PlatformPayView from '../specs/NativePlatformPayView';
import Styles from './common/Styles';
import { jsx as _jsx } from "react/jsx-runtime";
export const GooglePayButtonTheme = {
DARK: 1,
LIGHT: 2
};
export const GooglePayButtonType = {
BUY: 1,
BOOK: 2,
CHECKOUT: 3,
DONATE: 4,
ORDER: 5,
PAY: 6,
SUBSCRIBE: 7,
PLAIN: 8
};
function getButtonTheme(type) {
return GooglePayButtonTheme[type] ?? GooglePayButtonTheme.DARK;
}
function getButtonType(type) {
return GooglePayButtonType[type] ?? GooglePayButtonType.PAY;
}
export const GooglePayButton = ({
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=GooglePayButton.js.map