UNPKG

@google/react-native-make-payment

Version:
63 lines (62 loc) 2.67 kB
"use strict"; var React = _interopRequireWildcard(require("react")); var _reactNative = require("react-native"); var _NativeModules$Google; /* * Copyright 2024 Google LLC. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } const NativeGooglePayButton = (0, _reactNative.requireNativeComponent)('GooglePayButton'); const GooglePayButtonConstants = (_NativeModules$Google = _reactNative.NativeModules.GooglePayButtonConstants) === null || _NativeModules$Google === void 0 ? void 0 : _NativeModules$Google.getConstants(); const GooglePayButton = ({ onPress, disabled, allowedPaymentMethods, theme, type, radius, style }) => { return /*#__PURE__*/React.createElement(_reactNative.TouchableOpacity, { onPress: onPress, disabled: disabled, activeOpacity: disabled ? 0.3 : 1, style: [disabled ? styles.disabled : styles.notDisabled, style] }, /*#__PURE__*/React.createElement(NativeGooglePayButton, { allowedPaymentMethods: allowedPaymentMethods, type: type, theme: theme, radius: radius, style: styles.nativeButtonStyle })); }; const styles = _reactNative.StyleSheet.create({ disabled: { flex: 0, opacity: 0.4 }, notDisabled: { flex: 0 }, nativeButtonStyle: { flex: 1 } }); module.exports = { GooglePayButton, GooglePayButtonConstants }; //# sourceMappingURL=GooglePayButton.js.map