/* global alert */ import React, { Component } from 'react'; import { View, Share } from 'react-native'; import { BlueLoading, BlueCopyTextToClipboard, SafeBlueArea, BlueButton, BlueNavigationStyle, BlueText, BlueSpacing20, } from '../../BlueComponents'; import PropTypes from 'prop-types'; import QRCode from 'react-native-qrcode-svg'; /** @type {AppStorage} */ let BlueApp = require('../../BlueApp'); const loc = require('../../loc'); export default class LNDViewAdditionalInvoiceInformation extends Component { static navigationOptions = ({ navigation }) => ({ ...BlueNavigationStyle(), title: 'Additional Information', }); state = { walletInfo: undefined }; async componentDidMount() { const fromWallet = this.props.navigation.getParam('fromWallet'); try { await fromWallet.fetchInfo(); } catch (_) { alert('Network error'); return; } this.setState({ walletInfo: fromWallet.info_raw, addressText: fromWallet.info_raw.uris[0] }); } render() { if (typeof this.state.walletInfo === 'undefined') { return ( ); } return ( {loc.lndViewInvoice.open_direct_channel} { Share.share({ message: this.state.walletInfo.uris[0], }); }} title={loc.receive.details.share} /> ); } } LNDViewAdditionalInvoiceInformation.propTypes = { navigation: PropTypes.shape({ goBack: PropTypes.func, getParam: PropTypes.func, dismiss: PropTypes.func, }), };