Created separate screen for setting amount to receive

This commit is contained in:
Pavel Ševčík 2018-12-25 15:25:12 +01:00
parent 85867728d8
commit 6ee2a9932d
10 changed files with 234 additions and 150 deletions

View file

@ -24,6 +24,7 @@ import rbf from './screen/transactions/RBF';
import createrbf from './screen/transactions/RBF-create';
import receiveDetails from './screen/receive/details';
import setReceiveAmount from './screen/receive/receiveAmount';
import sendDetails from './screen/send/details';
import sendScanQrAddress from './screen/send/scanQrAddress';
@ -166,6 +167,10 @@ const MainBottomTabs = createStackNavigator(
screen: receiveDetails,
},
ReceiveAmount: {
screen: setReceiveAmount,
},
//
// LND:

View file

@ -153,8 +153,8 @@ module.exports = {
title: 'Share this address with payer',
share: 'share',
copiedToClipboard: 'Copied to clipboard.',
amount: 'amount to receive (BTC)',
label: 'note to sender',
label: 'Description',
setAmount: 'Receive with amount',
},
},
buyBitcoin: {

View file

@ -154,8 +154,8 @@ module.exports = {
title: 'Comparte esta dirección con el pagador',
share: 'Compartir',
copiedToClipboard: 'Copiado a portapapeles.',
amount: 'amount to receive (BTC)',
label: 'note to sender',
label: 'Description',
setAmount: 'Receive with amount',
},
},
buyBitcoin: {

View file

@ -155,8 +155,8 @@ module.exports = {
title: 'Partilhar este endereço com o pagador',
share: 'partilhar',
copiedToClipboard: 'copiado para clip board',
amount: 'amount to receive (BTC)',
label: 'note to sender',
label: 'Description',
setAmount: 'Receive with amount',
},
},
buyBitcoin: {

View file

@ -159,8 +159,8 @@ module.exports = {
title: 'Partilhar este endereço com o pagador',
share: 'partilhar',
copiedToClipboard: 'copiado para clip board',
amount: 'amount to receive (BTC)',
label: 'note to sender',
label: 'Description',
setAmount: 'Receive with amount',
},
},
settings: {

View file

@ -158,8 +158,8 @@ module.exports = {
title: 'Покажите этот адрес плательщику',
share: 'Отправить',
copiedToClipboard: 'скопировано',
amount: 'amount to receive (BTC)',
label: 'note to sender',
label: 'Description',
setAmount: 'Receive with amount',
},
},
settings: {

View file

@ -153,8 +153,8 @@ module.exports = {
title: 'Покажіть цю адресу платникові',
share: 'Відправити',
copiedToClipboard: 'Зкопіювано',
amount: 'amount to receive (BTC)',
label: 'note to sender',
label: 'Description',
setAmount: 'Receive with amount',
},
},
buyBitcoin: {

64
package-lock.json generated
View file

@ -1,6 +1,6 @@
{
"name": "BlueWallet",
"version": "3.3.0",
"version": "3.4.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -1446,7 +1446,7 @@
},
"abstract-leveldown": {
"version": "0.12.3",
"resolved": "http://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-0.12.3.tgz",
"resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-0.12.3.tgz",
"integrity": "sha1-EWsexcdxDvei1XBnaLvbREC+EHA=",
"requires": {
"xtend": "~3.0.0"
@ -1557,7 +1557,7 @@
},
"ansi-escapes": {
"version": "3.1.0",
"resolved": "http://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz",
"resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz",
"integrity": "sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw=="
},
"ansi-gray": {
@ -1961,7 +1961,7 @@
},
"array-equal": {
"version": "1.0.0",
"resolved": "http://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz",
"resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz",
"integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=",
"dev": true
},
@ -2050,7 +2050,7 @@
},
"util": {
"version": "0.10.3",
"resolved": "http://registry.npmjs.org/util/-/util-0.10.3.tgz",
"resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz",
"integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=",
"requires": {
"inherits": "2.0.1"
@ -4007,7 +4007,7 @@
},
"es6-promisify": {
"version": "5.0.0",
"resolved": "http://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz",
"resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz",
"integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=",
"requires": {
"es6-promise": "^4.0.3"
@ -4266,7 +4266,7 @@
},
"doctrine": {
"version": "1.5.0",
"resolved": "http://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz",
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz",
"integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=",
"dev": true,
"requires": {
@ -4284,7 +4284,7 @@
},
"eslint-plugin-node": {
"version": "6.0.1",
"resolved": "http://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-6.0.1.tgz",
"resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-6.0.1.tgz",
"integrity": "sha512-Q/Cc2sW1OAISDS+Ji6lZS2KV4b7ueA/WydVWd1BECTQwVvfQy5JAi3glhINoKzoMnfnuRgNP+ZWKrGAbp3QDxw==",
"dev": true,
"requires": {
@ -4345,7 +4345,7 @@
},
"espree": {
"version": "3.5.4",
"resolved": "http://registry.npmjs.org/espree/-/espree-3.5.4.tgz",
"resolved": "https://registry.npmjs.org/espree/-/espree-3.5.4.tgz",
"integrity": "sha512-yAcIQxtmMiB/jL32dzEp2enBeidsB7xWPLNiw3IIkpVds1P+h7qF9YwJq1yUNzp2OKXgAprs4F61ih66UsoD1A==",
"dev": true,
"requires": {
@ -4404,7 +4404,7 @@
},
"events": {
"version": "1.1.1",
"resolved": "http://registry.npmjs.org/events/-/events-1.1.1.tgz",
"resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz",
"integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ="
},
"evp_bytestokey": {
@ -4511,7 +4511,7 @@
},
"fast-deep-equal": {
"version": "1.1.0",
"resolved": "http://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz",
"integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=",
"dev": true
},
@ -4775,7 +4775,7 @@
},
"fs-extra": {
"version": "1.0.0",
"resolved": "http://registry.npmjs.org/fs-extra/-/fs-extra-1.0.0.tgz",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-1.0.0.tgz",
"integrity": "sha1-zTzl9+fLYUWIP8rjGR6Yd/hYeVA=",
"requires": {
"graceful-fs": "^4.1.2",
@ -6843,7 +6843,7 @@
},
"jest-get-type": {
"version": "22.4.3",
"resolved": "http://registry.npmjs.org/jest-get-type/-/jest-get-type-22.4.3.tgz",
"resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-22.4.3.tgz",
"integrity": "sha512-/jsz0Y+V29w1chdXVygEKSz2nBoHoYqNShPe+QgxSNjAuP1i8+k4LbQNrfoliKej0P45sivkSCh7yiD6ubHS3w==",
"dev": true
},
@ -8385,7 +8385,7 @@
},
"lodash.isempty": {
"version": "4.4.0",
"resolved": "http://registry.npmjs.org/lodash.isempty/-/lodash.isempty-4.4.0.tgz",
"resolved": "https://registry.npmjs.org/lodash.isempty/-/lodash.isempty-4.4.0.tgz",
"integrity": "sha1-b4bL7di+TsmHvpqvM8loTbGzHn4="
},
"lodash.memoize": {
@ -8798,12 +8798,12 @@
},
"mime-db": {
"version": "1.23.0",
"resolved": "http://registry.npmjs.org/mime-db/-/mime-db-1.23.0.tgz",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.23.0.tgz",
"integrity": "sha1-oxtAcK2uon1zLqMzdApk0OyaZlk="
},
"mime-types": {
"version": "2.1.11",
"resolved": "http://registry.npmjs.org/mime-types/-/mime-types-2.1.11.tgz",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.11.tgz",
"integrity": "sha1-wlnEcb2oCKhdbNGTtDCl+uRHOzw=",
"requires": {
"mime-db": "~1.23.0"
@ -9397,7 +9397,7 @@
},
"npmlog": {
"version": "2.0.4",
"resolved": "http://registry.npmjs.org/npmlog/-/npmlog-2.0.4.tgz",
"resolved": "https://registry.npmjs.org/npmlog/-/npmlog-2.0.4.tgz",
"integrity": "sha1-mLUlMPJRTKkNCexbIsiEZyI3VpI=",
"requires": {
"ansi": "~0.3.1",
@ -9568,7 +9568,7 @@
"dependencies": {
"ansi-escapes": {
"version": "1.4.0",
"resolved": "http://registry.npmjs.org/ansi-escapes/-/ansi-escapes-1.4.0.tgz",
"resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-1.4.0.tgz",
"integrity": "sha1-06ioOzGapneTZisT52HHkRQiMG4="
},
"ansi-styles": {
@ -9688,7 +9688,7 @@
},
"os-homedir": {
"version": "1.0.2",
"resolved": "http://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
"resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
"integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=",
"dev": true
},
@ -9725,7 +9725,7 @@
},
"os-tmpdir": {
"version": "1.0.2",
"resolved": "http://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
"resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
"integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ="
},
"p-defer": {
@ -9834,7 +9834,7 @@
},
"path-is-absolute": {
"version": "1.0.1",
"resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
},
"path-is-inside": {
@ -9901,7 +9901,7 @@
},
"pify": {
"version": "2.3.0",
"resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw="
},
"pinkie": {
@ -10584,7 +10584,7 @@
},
"react-native-elements": {
"version": "0.19.1",
"resolved": "http://registry.npmjs.org/react-native-elements/-/react-native-elements-0.19.1.tgz",
"resolved": "https://registry.npmjs.org/react-native-elements/-/react-native-elements-0.19.1.tgz",
"integrity": "sha1-+Stp2GShUCFdAfgf48UqnK2oPkU=",
"requires": {
"lodash.isempty": "^4.4.0",
@ -11057,7 +11057,7 @@
},
"regexpp": {
"version": "1.1.0",
"resolved": "http://registry.npmjs.org/regexpp/-/regexpp-1.1.0.tgz",
"resolved": "https://registry.npmjs.org/regexpp/-/regexpp-1.1.0.tgz",
"integrity": "sha512-LOPw8FpgdQF9etWMaAfG/WRthIdXJGYp4mJ2Jgn/2lpkbod9jPn0t9UqN7AxBOKNfzRbYyVfgc7Vk4t/MpnXgw==",
"dev": true
},
@ -11089,7 +11089,7 @@
"dependencies": {
"jsesc": {
"version": "0.5.0",
"resolved": "http://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz",
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz",
"integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0="
}
}
@ -11218,7 +11218,7 @@
},
"require-uncached": {
"version": "1.0.3",
"resolved": "http://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz",
"resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz",
"integrity": "sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM=",
"dev": true,
"requires": {
@ -11331,7 +11331,7 @@
"dependencies": {
"fs-extra": {
"version": "0.22.1",
"resolved": "http://registry.npmjs.org/fs-extra/-/fs-extra-0.22.1.tgz",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.22.1.tgz",
"integrity": "sha1-X9b4BJ3JdsoZ6yNV1lgXPKvM4FY=",
"dev": true,
"requires": {
@ -11406,7 +11406,7 @@
},
"safe-regex": {
"version": "1.1.0",
"resolved": "http://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz",
"resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz",
"integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=",
"requires": {
"ret": "~0.1.10"
@ -11792,7 +11792,7 @@
},
"serialize-error": {
"version": "2.1.0",
"resolved": "http://registry.npmjs.org/serialize-error/-/serialize-error-2.1.0.tgz",
"resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-2.1.0.tgz",
"integrity": "sha1-ULZ51WNc34Rme9yOWa9OW4HV9go="
},
"serve-static": {
@ -11912,7 +11912,7 @@
},
"xmlbuilder": {
"version": "8.2.2",
"resolved": "http://registry.npmjs.org/xmlbuilder/-/xmlbuilder-8.2.2.tgz",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-8.2.2.tgz",
"integrity": "sha1-aSSGc0ELS6QuGmE2VR0pIjNap3M="
}
}
@ -12364,7 +12364,7 @@
},
"strip-ansi": {
"version": "3.0.1",
"resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"requires": {
"ansi-regex": "^2.0.0"
@ -12377,7 +12377,7 @@
},
"strip-eof": {
"version": "1.0.0",
"resolved": "http://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
"resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
"integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8="
},
"strip-json-comments": {

View file

@ -1,8 +1,8 @@
import React, { Component } from 'react';
import { Animated, StyleSheet, View, TouchableOpacity, Clipboard, Share, TextInput, KeyboardAvoidingView } from 'react-native';
import { Animated, StyleSheet, View, TouchableOpacity, Clipboard, Share } from 'react-native';
import { QRCode } from 'react-native-custom-qr-codes';
import bip21 from 'bip21';
import { BlueLoading, SafeBlueArea, BlueButton, BlueNavigationStyle, is } from '../../BlueComponents';
import { BlueLoading, SafeBlueArea, BlueButton, BlueButtonLink, BlueNavigationStyle, is } from '../../BlueComponents';
import PropTypes from 'prop-types';
/** @type {AppStorage} */
let BlueApp = require('../../BlueApp');
@ -26,8 +26,6 @@ export default class ReceiveDetails extends Component {
address: address,
secret: secret,
addressText: '',
amount: undefined,
label: undefined,
};
// EV(EV.enum.RECEIVE_ADDRESS_CHANGED, this.refreshFunction.bind(this));
@ -79,117 +77,52 @@ export default class ReceiveDetails extends Component {
});
};
setAmount = value => {
if (!value || parseFloat(value) <= 0) {
this.setState({ amount: undefined });
} else {
this.setState({ amount: value });
}
};
setLabel = text => {
if (!text) {
this.setState({ label: undefined });
} else {
this.setState({ label: text });
}
};
render() {
console.log('render() receive/details, address,secret=', this.state.address, ',', this.state.secret);
if (this.state.isLoading) {
return <BlueLoading />;
}
const { amount, label } = this.state;
return (
<SafeBlueArea style={{ flex: 1 }}>
<View style={{ flex: 1, justifyContent: 'space-between', alignItems: 'center' }}>
<KeyboardAvoidingView behavior="position">
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center', paddingHorizontal: 16 }}>
<QRCode
content={bip21.encode(this.state.address, { amount, label })}
size={(is.ipad() && 300) || 300}
color={BlueApp.settings.foregroundColor}
backgroundColor={BlueApp.settings.brandingColor}
logo={require('../../img/qr-code.png')}
/>
<TouchableOpacity onPress={this.copyToClipboard}>
<Animated.Text style={styles.address} numberOfLines={0}>
{this.state.addressText}
</Animated.Text>
</TouchableOpacity>
<View
style={{
flexDirection: 'row',
borderColor: '#d2d2d2',
borderBottomColor: '#d2d2d2',
borderWidth: 1.0,
borderBottomWidth: 0.5,
backgroundColor: '#f5f5f5',
minHeight: 44,
height: 44,
marginHorizontal: 20,
alignItems: 'center',
marginVertical: 8,
borderRadius: 4,
width: '100%',
}}
>
<TextInput
onChangeText={this.setLabel}
placeholder={loc.receive.details.label}
value={this.state.label}
numberOfLines={1}
style={{ flex: 1, marginHorizontal: 8, minHeight: 33 }}
editable={!this.state.isLoading}
/>
</View>
<View
style={{
flexDirection: 'row',
borderColor: '#d2d2d2',
borderBottomColor: '#d2d2d2',
borderWidth: 1.0,
borderBottomWidth: 0.5,
backgroundColor: '#f5f5f5',
minHeight: 44,
height: 44,
marginHorizontal: 20,
alignItems: 'center',
marginVertical: 8,
borderRadius: 4,
width: '100%',
}}
>
<TextInput
onChangeText={this.setAmount}
placeholder={loc.receive.details.amount}
value={this.state.amount}
numberOfLines={1}
style={{ flex: 1, marginHorizontal: 8, minHeight: 33 }}
editable={!this.state.isLoading}
keyboardType="numeric"
/>
</View>
</View>
<View style={{ marginBottom: 24 }}>
<BlueButton
icon={{
name: 'share-alternative',
type: 'entypo',
color: BlueApp.settings.buttonTextColor,
}}
onPress={async () => {
Share.share({
message: this.state.address,
});
}}
title={loc.receive.details.share}
/>
</View>
</KeyboardAvoidingView>
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center', paddingHorizontal: 16 }}>
<QRCode
content={bip21.encode(this.state.address)}
size={(is.ipad() && 300) || 300}
color={BlueApp.settings.foregroundColor}
backgroundColor={BlueApp.settings.brandingColor}
logo={require('../../img/qr-code.png')}
/>
<TouchableOpacity onPress={this.copyToClipboard}>
<Animated.Text style={styles.address} numberOfLines={0}>
{this.state.addressText}
</Animated.Text>
</TouchableOpacity>
</View>
<View style={{ marginBottom: 24 }}>
<BlueButtonLink
title={loc.receive.details.setAmount}
onPress={() => {
this.props.navigation.navigate('ReceiveAmount', {
address: this.state.address,
});
}}
/>
<BlueButton
icon={{
name: 'share-alternative',
type: 'entypo',
color: BlueApp.settings.buttonTextColor,
}}
onPress={async () => {
Share.share({
message: this.state.address,
});
}}
title={loc.receive.details.share}
/>
</View>
</View>
</SafeBlueArea>
);
@ -208,6 +141,7 @@ const styles = StyleSheet.create({
ReceiveDetails.propTypes = {
navigation: PropTypes.shape({
goBack: PropTypes.function,
navigate: PropTypes.function,
state: PropTypes.shape({
params: PropTypes.shape({
address: PropTypes.string,

View file

@ -0,0 +1,145 @@
import React, { Component } from 'react';
import { StyleSheet, View, Share, TextInput, KeyboardAvoidingView, Clipboard, Animated, TouchableOpacity } from 'react-native';
import { QRCode } from 'react-native-custom-qr-codes';
import bip21 from 'bip21';
import { SafeBlueArea, BlueButton, BlueNavigationStyle, is, BlueBitcoinAmount, BlueText } from '../../BlueComponents';
import PropTypes from 'prop-types';
/** @type {AppStorage} */
let BlueApp = require('../../BlueApp');
let loc = require('../../loc');
export default class ReceiveAmount extends Component {
static navigationOptions = ({ navigation }) => ({
...BlueNavigationStyle(navigation, true),
title: loc.receive.header,
headerLeft: null,
});
static propTypes = {
navigation: PropTypes.shape({
state: PropTypes.shape({
params: PropTypes.shape({
address: PropTypes.string,
}),
}),
}),
};
constructor(props) {
super(props);
let address = props.navigation.state.params.address;
this.state = {
address: address,
addressText: address,
amount: undefined,
label: undefined,
amountSet: false,
};
}
copyToClipboard = () => {
this.setState({ addressText: loc.receive.details.copiedToClipboard }, () => {
Clipboard.setString(this.state.address);
setTimeout(() => this.setState({ addressText: this.state.address }), 1000);
});
};
renderDefault() {
return (
<View>
<View
style={{
flexDirection: 'row',
borderColor: '#d2d2d2',
borderBottomColor: '#d2d2d2',
borderWidth: 1.0,
borderBottomWidth: 0.5,
backgroundColor: '#f5f5f5',
minHeight: 44,
height: 44,
marginHorizontal: 20,
alignItems: 'center',
marginVertical: 8,
borderRadius: 4,
}}
>
<TextInput
onChangeText={text => this.setState({ label: text })}
placeholder={loc.receive.details.label}
value={this.state.label || ''}
numberOfLines={1}
style={{ flex: 1, marginHorizontal: 8, minHeight: 33 }}
editable={!this.state.isLoading}
/>
</View>
<BlueButton title="Create" onPress={() => this.setState({ amountSet: true })} />
</View>
);
}
renderWithSetAmount() {
return (
<View style={{ justifyContent: 'space-between' }}>
<BlueText style={{ color: '#0c2550', fontWeight: '600', textAlign: 'center', paddingBottom: 24 }} numberOfLines={1}>
{this.state.label}
</BlueText>
<View style={{ justifyContent: 'center', alignItems: 'center', paddingHorizontal: 16 }}>
<QRCode
content={bip21.encode(this.state.address, { amount: this.state.amount, label: this.state.label })}
size={(is.ipad() && 300) || 300}
color={BlueApp.settings.foregroundColor}
backgroundColor={BlueApp.settings.brandingColor}
logo={require('../../img/qr-code.png')}
/>
</View>
<TouchableOpacity onPress={this.copyToClipboard}>
<Animated.Text style={styles.address} numberOfLines={0}>
{this.state.addressText}
</Animated.Text>
</TouchableOpacity>
<BlueButton
icon={{
name: 'share-alternative',
type: 'entypo',
color: BlueApp.settings.buttonTextColor,
}}
onPress={async () => {
Share.share({
message: bip21.encode(this.state.address, { amount: this.state.amount, label: this.state.label }),
});
}}
title={loc.receive.details.share}
/>
</View>
);
}
render() {
return (
<SafeBlueArea style={{ flex: 1 }}>
<View style={{ flex: 1, justifyContent: 'space-between' }}>
<View style={{ flex: 1, backgroundColor: '#FFFFFF' }}>
<KeyboardAvoidingView behavior="position">
<BlueBitcoinAmount
amount={this.state.amount || ''}
onChangeText={text => this.setState({ amount: text })}
disabled={this.state.amountSet}
/>
{this.state.amountSet ? this.renderWithSetAmount() : this.renderDefault()}
</KeyboardAvoidingView>
</View>
</View>
</SafeBlueArea>
);
}
}
const styles = StyleSheet.create({
address: {
marginVertical: 32,
fontSize: 15,
color: '#9aa0aa',
textAlign: 'center',
},
});