@google/react-native-make-payment
Version:
React Native library for making native payments
60 lines (59 loc) • 1.84 kB
JavaScript
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.
*/
import * as React from 'react';
import { NativeModules, requireNativeComponent, TouchableOpacity, StyleSheet } from 'react-native';
const NativeGooglePayButton = requireNativeComponent('GooglePayButton');
const GooglePayButtonConstants = (_NativeModules$Google = 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(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 = StyleSheet.create({
disabled: {
flex: 0,
opacity: 0.4
},
notDisabled: {
flex: 0
},
nativeButtonStyle: {
flex: 1
}
});
module.exports = {
GooglePayButton,
GooglePayButtonConstants
};
//# sourceMappingURL=GooglePayButton.js.map