boxpay-checkout-reactnative-sdk
Version:
Boxpay Payment Gateway
74 lines (73 loc) • 2.32 kB
JavaScript
"use strict";
import React, { useState } from 'react';
import { View, Text, Image, TouchableOpacity } from 'react-native';
import { SvgUri } from 'react-native-svg';
import ShimmerPlaceHolder from 'react-native-shimmer-placeholder';
import styles from "../styles/components/bankCardStyles.js";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
const BankCard = ({
name,
iconUrl,
hasNoCostEmi,
hasLowCostEmi,
onPress
}) => {
const [error, setImageError] = useState(false);
const [load, setLoad] = useState(true);
return /*#__PURE__*/_jsxs(TouchableOpacity, {
style: styles.container,
onPress: onPress,
children: [/*#__PURE__*/_jsxs(View, {
style: styles.imageContainer,
children: [load && !error && /*#__PURE__*/_jsx(ShimmerPlaceHolder, {
visible: false // Keep shimmer until loading is done
,
style: styles.shimmer
}), !error ? /*#__PURE__*/_jsx(SvgUri, {
uri: iconUrl,
width: 100 // Keep original size
,
height: 100,
style: {
transform: [{
scale: 0.4
}]
},
onLoad: () => setLoad(false),
onError: () => {
setImageError(true);
setLoad(false);
}
}) : /*#__PURE__*/_jsx(Image, {
source: require('../../assets/images/ic_netbanking_semi_bold.png'),
style: styles.errorImage
})]
}), /*#__PURE__*/_jsxs(View, {
style: styles.detailsContainer,
children: [/*#__PURE__*/_jsx(Text, {
style: styles.bankName,
children: name
}), /*#__PURE__*/_jsxs(View, {
style: styles.tagsContainer,
children: [hasNoCostEmi && /*#__PURE__*/_jsx(View, {
style: styles.tag,
children: /*#__PURE__*/_jsx(Text, {
style: styles.tagText,
children: "NO COST EMI"
})
}), hasLowCostEmi && /*#__PURE__*/_jsx(View, {
style: styles.tag,
children: /*#__PURE__*/_jsx(Text, {
style: styles.tagText,
children: "LOW COST EMI"
})
})]
})]
}), /*#__PURE__*/_jsx(Image, {
source: require('../../assets/images/chervon-down.png'),
style: styles.chervonImage
})]
});
};
export default BankCard;
//# sourceMappingURL=bankCard.js.map