mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-23 15:20:55 +01:00
ADD: Export xPub as a file #4796
This commit is contained in:
parent
c5adbaa6ee
commit
81076a5e22
2 changed files with 28 additions and 15 deletions
|
@ -13,7 +13,6 @@ import {
|
|||
} from 'react-native';
|
||||
import { useNavigation, useRoute, useTheme, useFocusEffect } from '@react-navigation/native';
|
||||
import Share from 'react-native-share';
|
||||
|
||||
import QRCodeComponent from '../../components/QRCodeComponent';
|
||||
import {
|
||||
BlueLoading,
|
||||
|
|
|
@ -2,13 +2,14 @@ import React, { useCallback, useContext, useEffect, useState } from 'react';
|
|||
import { InteractionManager, ActivityIndicator, View, StatusBar, StyleSheet } from 'react-native';
|
||||
import { useFocusEffect, useRoute, useNavigation, useTheme } from '@react-navigation/native';
|
||||
import navigationStyle from '../../components/navigationStyle';
|
||||
import { BlueSpacing20, SafeBlueArea, BlueText, BlueCopyTextToClipboard } from '../../BlueComponents';
|
||||
import { BlueSpacing20, SafeBlueArea, BlueText, BlueCopyTextToClipboard, BlueButton } from '../../BlueComponents';
|
||||
import Privacy from '../../blue_modules/Privacy';
|
||||
import Biometric from '../../class/biometrics';
|
||||
import loc from '../../loc';
|
||||
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
||||
import QRCodeComponent from '../../components/QRCodeComponent';
|
||||
import HandoffComponent from '../../components/handoff';
|
||||
import Share from 'react-native-share';
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
root: {
|
||||
|
@ -20,6 +21,10 @@ const styles = StyleSheet.create({
|
|||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
},
|
||||
share: {
|
||||
alignSelf: 'center',
|
||||
width: '40%',
|
||||
},
|
||||
});
|
||||
|
||||
const WalletXpub = () => {
|
||||
|
@ -68,6 +73,10 @@ const WalletXpub = () => {
|
|||
setQRCodeSize(height > width ? width - 40 : e.nativeEvent.layout.width / 1.8);
|
||||
};
|
||||
|
||||
const handleShareButtonPressed = () => {
|
||||
Share.open({ message: xpub }).catch(error => console.log(error));
|
||||
};
|
||||
|
||||
return isLoading ? (
|
||||
<View style={[styles.container, stylesHook.root]}>
|
||||
<ActivityIndicator />
|
||||
|
@ -75,21 +84,26 @@ const WalletXpub = () => {
|
|||
) : (
|
||||
<SafeBlueArea style={[styles.root, stylesHook.root]} onLayout={onLayout}>
|
||||
<StatusBar barStyle="light-content" />
|
||||
<View style={styles.container}>
|
||||
{wallet && (
|
||||
<>
|
||||
<View>
|
||||
<BlueText>{wallet.typeReadable}</BlueText>
|
||||
</View>
|
||||
<BlueSpacing20 />
|
||||
</>
|
||||
)}
|
||||
<QRCodeComponent value={xpub} size={qrCodeSize} />
|
||||
<>
|
||||
<View style={styles.container}>
|
||||
{wallet && (
|
||||
<>
|
||||
<View>
|
||||
<BlueText>{wallet.typeReadable}</BlueText>
|
||||
</View>
|
||||
<BlueSpacing20 />
|
||||
</>
|
||||
)}
|
||||
<QRCodeComponent value={xpub} size={qrCodeSize} />
|
||||
|
||||
<BlueSpacing20 />
|
||||
<BlueCopyTextToClipboard text={xPubText} />
|
||||
<BlueSpacing20 />
|
||||
<BlueCopyTextToClipboard text={xPubText} />
|
||||
</View>
|
||||
<HandoffComponent title={loc.wallets.xpub_title} type={HandoffComponent.activityTypes.Xpub} userInfo={{ xpub: xPubText }} />
|
||||
</View>
|
||||
<View style={styles.share}>
|
||||
<BlueButton onPress={handleShareButtonPressed} title={loc.receive.details_share} />
|
||||
</View>
|
||||
</>
|
||||
</SafeBlueArea>
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue