Browse Source

Feature: Allow XPUB to be copied to clipboard

localNotifications
Pavel Ševčík 6 years ago
parent
commit
6e4d863eb3
  1. 1
      loc/en.js
  2. 1
      loc/es.js
  3. 1
      loc/pt_BR.js
  4. 1
      loc/pt_PT.js
  5. 1
      loc/ru.js
  6. 1
      loc/ua.js
  7. 16
      screen/wallets/xpub.js

1
loc/en.js

@ -67,6 +67,7 @@ module.exports = {
},
xpub: {
title: 'wallet XPUB',
copiedToClipboard: 'Copied to clipboard.',
},
import: {
title: 'import',

1
loc/es.js

@ -67,6 +67,7 @@ module.exports = {
},
xpub: {
title: 'wallet XPUB',
copiedToClipboard: 'Copiado a portapapeles.',
},
import: {
title: 'importar',

1
loc/pt_BR.js

@ -68,6 +68,7 @@ module.exports = {
},
xpub: {
title: 'wallet XPUB',
copiedToClipboard: 'copiado para clip board',
},
import: {
title: 'importar',

1
loc/pt_PT.js

@ -67,6 +67,7 @@ module.exports = {
},
xpub: {
title: 'wallet XPUB',
copiedToClipboard: 'copiado para clip board',
},
import: {
title: 'importar',

1
loc/ru.js

@ -67,6 +67,7 @@ module.exports = {
},
xpub: {
title: 'wallet XPUB',
copiedToClipboard: 'скопировано',
},
import: {
title: 'import',

1
loc/ua.js

@ -67,6 +67,7 @@ module.exports = {
},
xpub: {
title: 'wallet XPUB',
copiedToClipboard: 'Зкопіювано',
},
import: {
title: 'імпорт',

16
screen/wallets/xpub.js

@ -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…
Cancel
Save