mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2024-11-20 02:09:10 +01:00
Feature: Allow XPUB to be copied to clipboard
This commit is contained in:
parent
46edce17b9
commit
6e4d863eb3
@ -67,6 +67,7 @@ module.exports = {
|
||||
},
|
||||
xpub: {
|
||||
title: 'wallet XPUB',
|
||||
copiedToClipboard: 'Copied to clipboard.',
|
||||
},
|
||||
import: {
|
||||
title: 'import',
|
||||
|
@ -67,6 +67,7 @@ module.exports = {
|
||||
},
|
||||
xpub: {
|
||||
title: 'wallet XPUB',
|
||||
copiedToClipboard: 'Copiado a portapapeles.',
|
||||
},
|
||||
import: {
|
||||
title: 'importar',
|
||||
|
@ -68,6 +68,7 @@ module.exports = {
|
||||
},
|
||||
xpub: {
|
||||
title: 'wallet XPUB',
|
||||
copiedToClipboard: 'copiado para clip board',
|
||||
},
|
||||
import: {
|
||||
title: 'importar',
|
||||
|
@ -67,6 +67,7 @@ module.exports = {
|
||||
},
|
||||
xpub: {
|
||||
title: 'wallet XPUB',
|
||||
copiedToClipboard: 'copiado para clip board',
|
||||
},
|
||||
import: {
|
||||
title: 'importar',
|
||||
|
@ -67,6 +67,7 @@ module.exports = {
|
||||
},
|
||||
xpub: {
|
||||
title: 'wallet XPUB',
|
||||
copiedToClipboard: 'скопировано',
|
||||
},
|
||||
import: {
|
||||
title: 'import',
|
||||
|
@ -67,6 +67,7 @@ module.exports = {
|
||||
},
|
||||
xpub: {
|
||||
title: 'wallet XPUB',
|
||||
copiedToClipboard: 'Зкопіювано',
|
||||
},
|
||||
import: {
|
||||
title: 'імпорт',
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React, { Component } from 'react';
|
||||
import { Dimensions, Platform, ActivityIndicator, View } from 'react-native';
|
||||
import { Dimensions, Platform, ActivityIndicator, View, Clipboard, Animated, TouchableOpacity } from 'react-native';
|
||||
import { QRCode as QRSlow } from 'react-native-custom-qr-codes';
|
||||
import { BlueSpacing40, SafeBlueArea, BlueCard, BlueText, BlueHeaderDefaultSub } from '../../BlueComponents';
|
||||
import PropTypes from 'prop-types';
|
||||
@ -40,6 +40,7 @@ export default class WalletXpub extends Component {
|
||||
isLoading: true,
|
||||
wallet,
|
||||
xpub: wallet.getXpub(),
|
||||
xpubText: wallet.getXpub(),
|
||||
};
|
||||
}
|
||||
|
||||
@ -61,6 +62,13 @@ export default class WalletXpub extends Component {
|
||||
return 312;
|
||||
};
|
||||
|
||||
copyToClipboard = () => {
|
||||
this.setState({ xpubText: loc.wallets.xpub.copiedToClipboard }, () => {
|
||||
Clipboard.setString(this.state.xpub);
|
||||
setTimeout(() => this.setState({ xpubText: this.state.xpub }), 1000);
|
||||
});
|
||||
};
|
||||
|
||||
render() {
|
||||
if (this.state.isLoading) {
|
||||
return (
|
||||
@ -124,7 +132,11 @@ export default class WalletXpub extends Component {
|
||||
}
|
||||
})()}
|
||||
|
||||
<BlueText style={{ marginVertical: 8 }}>{this.state.xpub}</BlueText>
|
||||
<TouchableOpacity onPress={this.copyToClipboard}>
|
||||
<Animated.Text style={{ marginVertical: 8, textAlign: 'center' }} numberOfLines={0}>
|
||||
{this.state.xpubText}
|
||||
</Animated.Text>
|
||||
</TouchableOpacity>
|
||||
</BlueCard>
|
||||
</SafeBlueArea>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user