BlueWallet/screen/wallets/PaymentCode.tsx

37 lines
1.1 KiB
TypeScript
Raw Normal View History

2024-05-20 10:54:13 +01:00
import { useRoute } from '@react-navigation/native';
import { NativeStackScreenProps } from '@react-navigation/native-stack';
2022-12-06 21:43:54 -05:00
import React from 'react';
2024-02-24 06:27:17 -05:00
import { StyleSheet, Text, View } from 'react-native';
2024-05-20 10:54:13 +01:00
import CopyTextToClipboard from '../../components/CopyTextToClipboard';
2022-12-06 21:43:54 -05:00
import QRCodeComponent from '../../components/QRCodeComponent';
2023-04-06 19:29:34 +03:00
import loc from '../../loc';
2024-05-11 12:50:06 -04:00
import { PaymentCodeStackParamList } from '../../navigation/PaymentCodeStack';
2022-12-06 21:43:54 -05:00
2024-02-24 06:27:17 -05:00
type Props = NativeStackScreenProps<PaymentCodeStackParamList, 'PaymentCode'>;
2022-12-06 21:43:54 -05:00
2024-05-11 12:50:06 -04:00
export default function PaymentCode() {
const route = useRoute();
const { paymentCode } = route.params as Props['route']['params'];
2022-12-06 21:43:54 -05:00
return (
<View style={styles.container}>
2023-04-06 19:29:34 +03:00
{!paymentCode && <Text>{loc.bip47.not_found}</Text>}
2022-12-11 21:34:50 -05:00
{paymentCode && (
<>
<QRCodeComponent value={paymentCode} />
<CopyTextToClipboard text={paymentCode} truncated={false} />
2022-12-11 21:34:50 -05:00
</>
)}
2022-12-06 21:43:54 -05:00
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
});