import React from 'react'; import { Image, Modal, ScrollView, StyleSheet, Text, TouchableOpacity, View, } from 'react-native'; import * as Animatable from 'react-native-animatable'; export type WalletBindAction = { key: string; label: string; }; export type WalletSelectRow = { walletType: string; label: string; actions: WalletBindAction[]; }; export const WALLET_ICONS: Record = { paytm: require('../res/paytm.png'), 'paytm business': require('../res/paytm-business.png'), phonepe: require('../res/phonepe.webp'), 'phonepe business': require('../res/phonepe-business.webp'), 'googlepay business': require('../res/googlepay-business.webp'), 'bharatpe business': require('../res/bharatpe-business.webp'), mobikwik: require('../res/mobikwik.png'), freecharge: require('../res/freecharge.png'), amazonpay: require('../res/amazon.png'), }; export const WALLET_TYPE_COLORS: Record = { paytm: '#002970', 'paytm business': '#002970', phonepe: '#5a2d9c', 'phonepe business': '#5a2d9c', 'googlepay business': '#4285f4', 'bharatpe business': '#e91e63', mobikwik: '#00bcd4', freecharge: '#ff5722', amazonpay: '#ff9900', }; const TOKEN_MODE = 'Token Mode'; const OTP_MODE = 'Otp Mode'; export const WALLET_SELECT_ROWS: WalletSelectRow[] = [ { walletType: 'paytm', label: 'Paytm Personal', actions: [ { key: 'paytm_personal_token', label: TOKEN_MODE }, { key: 'paytm_personal_otp', label: OTP_MODE }, ], }, { walletType: 'paytm business', label: 'Paytm Business', actions: [{ key: 'paytm_business', label: OTP_MODE }], }, { walletType: 'phonepe', label: 'PhonePe Personal', actions: [ { key: 'phonepe_personal_token', label: TOKEN_MODE }, { key: 'phonepe_personal_otp', label: OTP_MODE }, ], }, { walletType: 'phonepe business', label: 'PhonePe Business', actions: [ { key: 'phonepe_business_web', label: TOKEN_MODE }, { key: 'phonepe_business_otp', label: OTP_MODE }, ], }, { walletType: 'googlepay business', label: 'GooglePay Business', actions: [{ key: 'googlepay_business', label: TOKEN_MODE }], }, { walletType: 'bharatpe business', label: 'BharatPe Business', actions: [{ key: 'bharatpe_business', label: OTP_MODE }], }, { walletType: 'mobikwik', label: 'Mobikwik Personal', actions: [ { key: 'mobikwik_personal_token', label: TOKEN_MODE }, { key: 'mobikwik_personal', label: OTP_MODE }, ], }, { walletType: 'freecharge', label: 'Freecharge Personal', actions: [ { key: 'freecharge_personal_token', label: TOKEN_MODE }, { key: 'freecharge_personal', label: OTP_MODE }, ], }, { walletType: 'amazonpay', label: 'Amazon Pay', actions: [{ key: 'amazonpay_personal', label: OTP_MODE }], }, ]; interface Props { visible: boolean; onClose: () => void; onSelectBind: (bindKey: string) => void; rows?: WalletSelectRow[]; } export const WalletSelectModal: React.FC = ({ visible, onClose, onSelectBind, rows = WALLET_SELECT_ROWS, }) => ( Select Wallet Type {rows.map((row) => ( {WALLET_ICONS[row.walletType] ? ( ) : ( )} {row.label} {row.actions.map((action) => ( onSelectBind(action.key)} activeOpacity={0.7} > {action.label} ))} ))} ); const styles = StyleSheet.create({ overlay: { flex: 1, backgroundColor: 'rgba(0,0,0,0.5)', justifyContent: 'center', alignItems: 'center', }, box: { backgroundColor: '#fff', borderRadius: 12, padding: 16, width: '88%', maxHeight: '80%', }, header: { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', marginBottom: 12, }, title: { fontSize: 17, fontWeight: '700', color: '#222', }, close: { fontSize: 20, color: '#999', }, row: { flexDirection: 'row', alignItems: 'center', paddingVertical: 12, borderBottomWidth: 1, borderBottomColor: '#f0f0f0', }, icon: { width: 32, height: 32, borderRadius: 6, marginRight: 10, }, dot: { width: 10, height: 10, borderRadius: 5, marginRight: 10, }, label: { flex: 1, fontSize: 14, color: '#333', marginRight: 8, }, actions: { flexDirection: 'row', alignItems: 'center', gap: 6, }, actionBtn: { paddingHorizontal: 8, paddingVertical: 6, borderRadius: 6, backgroundColor: '#f0f4ff', borderWidth: 1, borderColor: '#d0daf0', alignItems: 'center', }, actionBtnText: { fontSize: 11, fontWeight: '600', color: '#3355aa', }, });