import React, { Component } from 'react'; import { View, ActivityIndicator, Image, Text, TouchableOpacity, FlatList } from 'react-native'; import { SafeBlueArea, BlueNavigationStyle, BlueText, BlueSpacing20, BluePrivateBalance } from '../../BlueComponents'; import LinearGradient from 'react-native-linear-gradient'; import PropTypes from 'prop-types'; import { LightningCustodianWallet } from '../../class/lightning-custodian-wallet'; import ReactNativeHapticFeedback from 'react-native-haptic-feedback'; import WalletGradient from '../../class/walletGradient'; /** @type {AppStorage} */ let BlueApp = require('../../BlueApp'); let loc = require('../../loc'); export default class SelectWallet extends Component { static navigationOptions = ({ navigation }) => ({ ...BlueNavigationStyle(navigation, true, navigation.getParam('dismissAcion')), title: loc.wallets.select_wallet, }); constructor(props) { super(props); props.navigation.setParams({ dismissAcion: this.dismissComponent }); this.state = { isLoading: true, data: [], }; this.chainType = props.navigation.getParam('chainType'); } dismissComponent = () => { this.props.navigation.goBack(null); }; componentDidMount() { const wallets = this.chainType ? BlueApp.getWallets().filter(item => item.chain === this.chainType && item.allowSend()) : BlueApp.getWallets().filter(item => item.allowSend()); this.setState({ data: wallets, isLoading: false, }); } _renderItem = ({ item }) => { return ( { ReactNativeHapticFeedback.trigger('selection', { ignoreAndroidSystemSettings: false }); this.props.navigation.getParam('onWalletSelect')(item); }} > {item.getLabel()} {item.hideBalance ? ( ) : ( {loc.formatBalance(Number(item.getBalance()), item.getPreferredBalanceUnit(), true)} )} {loc.wallets.list.latest_transaction} {loc.transactionTimeToReadable(item.getLatestTransactionTime())} ); }; render() { if (this.state.isLoading) { return ( ); } else if (this.state.data.length <= 0) { return ( There are currently no Bitcoin wallets available. A Bitcoin wallet is required to refill Lightning wallets. Please, create or import one. ); } return ( `${index}`} /> ); } } SelectWallet.propTypes = { navigation: PropTypes.shape({ navigate: PropTypes.func, goBack: PropTypes.func, setParams: PropTypes.func, getParam: PropTypes.func, }), };