import React, { useEffect, useRef } from 'react'; import { Alert, StyleSheet, Text, TouchableOpacity, View } from 'react-native'; import { onProxyMessage, proxySendMessage, paytmPay, openMobikwikPayToBank, openPhonePePayToBank, openFreechargePayToBank } from 'rnwalletman'; export default function TestScreen() { const subRef = useRef | null>(null); useEffect(() => { subRef.current = onProxyMessage((msg) => { if (msg.type === 'echo') { Alert.alert('Echo Response', JSON.stringify(msg.data)); } }); return () => { subRef.current?.remove(); }; }, []); const handlePaytmPay = () => { paytmPay('2', 'Gurvir singh', '296001000405', 'ICIC0002960', '66666') .then(result => console.log(result)) .catch(error => Alert.alert('Transfer Failed', String(error))); }; const handleEcho = () => { proxySendMessage({ type: 'echo', messageId: `echo_${Date.now()}`, data: { text: `hello_${Date.now()}` } }); }; const handleMobikwikPayToBank = () => { openMobikwikPayToBank('7528905079', 'AIRP0000001', 'FAZLE HAQ', '2') .then(result => console.log('Mobikwik Pay To Bank', result ? 'Success' : 'Failed')) .catch(err => Alert.alert('Error', String(err))); }; const handlePhonePePayToBank = () => { openPhonePePayToBank('7973837549', 'AIRP0000001', 'FAZLE HAQ', '2.20', 'D72C8BD001') .then(result => console.log('PhonePe Pay To Bank', result ? 'Success' : 'Failed')) .catch((err: Error) => Alert.alert('Error', String(err))); }; const handleFreechargePayToBank = () => { openFreechargePayToBank('7528905079', 'AIRP0000001', 'FAZLE HAQ', '3.20', 'D72C8BD001') .then((result: boolean) => console.log('Freecharge Pay To Bank', result ? 'Success' : 'Failed')) .catch((err: Error) => Alert.alert('Error', String(err))); }; return ( Test Tools Paytm Pay To Bank Test Mobikwik Pay To Bank Test PhonePe Pay To Bank Test Freecharge Pay To Bank Test Echo Test ); } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#f0f0f0', padding: 20, alignItems: 'center', }, sectionTitle: { fontSize: 16, fontWeight: '600', color: '#333', alignSelf: 'flex-start', marginBottom: 16, marginTop: 8, }, btn: { width: '100%', paddingVertical: 14, borderRadius: 8, alignItems: 'center', marginBottom: 12, }, btnText: { color: '#fff', fontSize: 15, fontWeight: '600', }, });