import { useNavigation, useRoute } from '@react-navigation/native';
import React, { useEffect, useState } from 'react';
import { Share, StyleSheet, View } from 'react-native';
import { BlueLoading, BlueSpacing20, BlueText } from '../../BlueComponents';
import presentAlert from '../../components/Alert';
import Button from '../../components/Button';
import CopyTextToClipboard from '../../components/CopyTextToClipboard';
import QRCodeComponent from '../../components/QRCodeComponent';
import SafeArea from '../../components/SafeArea';
import { useTheme } from '../../components/themes';
import loc from '../../loc';
import { useStorage } from '../../hooks/context/useStorage';
const LNDViewAdditionalInvoiceInformation = () => {
const { walletID } = useRoute().params;
const { wallets } = useStorage();
const wallet = wallets.find(w => w.getID() === walletID);
const [walletInfo, setWalletInfo] = useState();
const { colors } = useTheme();
const { goBack } = useNavigation();
const stylesHook = StyleSheet.create({
loading: {
backgroundColor: colors.elevated,
},
root: {
backgroundColor: colors.elevated,
},
});
useEffect(() => {
if (wallet) {
wallet
.fetchInfo()
.then(_ => {
setWalletInfo(wallet.info_raw);
})
.catch(error => {
console.log(error);
presentAlert({ message: loc.errors.network });
goBack();
});
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [wallet]);
if (walletInfo === undefined) {
return (
);
}
return (
{loc.lndViewInvoice.open_direct_channel}
);
};
const styles = StyleSheet.create({
loading: {
justifyContent: 'space-between',
alignItems: 'center',
},
wrapper: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
qrcode: {
justifyContent: 'center',
alignItems: 'center',
},
share: {
marginBottom: 25,
},
});
export default LNDViewAdditionalInvoiceInformation;