ADD: import LNDHub from QR

This commit is contained in:
sha-265 2020-10-26 18:07:48 +02:00 committed by Overtorment
parent 6aa4ac5b71
commit d2c5aa8e55

View file

@ -2,8 +2,7 @@
import React, { useState, useEffect, useCallback } from 'react';
import { View, TextInput, Linking, StyleSheet } from 'react-native';
import { Button } from 'react-native-elements';
import { useTheme } from '@react-navigation/native';
import { useTheme, useNavigation, useRoute } from '@react-navigation/native';
import { AppStorage } from '../../class';
import AsyncStorage from '@react-native-community/async-storage';
import {
@ -14,6 +13,7 @@ import {
BlueNavigationStyle,
BlueLoadingHook,
BlueTextHooks,
BlueButtonLink,
} from '../../BlueComponents';
import { LightningCustodianWallet } from '../../class/wallets/lightning-custodian-wallet';
import loc from '../../loc';
@ -51,6 +51,8 @@ const LightningSettings = () => {
const [isLoading, setIsLoading] = useState(true);
const [URI, setURI] = useState();
const { colors } = useTheme();
const route = useRoute();
const navigation = useNavigation();
useEffect(() => {
AsyncStorage.getItem(AppStorage.LNDHUB)
@ -79,6 +81,18 @@ const LightningSettings = () => {
setIsLoading(false);
}, [URI]);
const importScan = () => {
navigation.navigate('ScanQRCodeRoot', {
screen: 'ScanQRCode',
params: {
launchedBy: route.name,
onBarScanned: setLndhubURI,
showFileImportButton: true,
},
});
};
return (
<SafeBlueArea forceInset={{ horizontal: 'always' }} style={styles.root}>
<BlueCard>
@ -115,6 +129,7 @@ const LightningSettings = () => {
/>
</View>
<BlueButtonLink title={loc.wallets.import_scan_qr} onPress={importScan} />
<BlueSpacing20 />
{isLoading ? <BlueLoadingHook /> : <BlueButton onPress={save} title={loc.settings.save} />}
</BlueCard>