diff --git a/screen/wallets/export.js b/screen/wallets/export.js
index 7e26e20e..e99401aa 100644
--- a/screen/wallets/export.js
+++ b/screen/wallets/export.js
@@ -1,20 +1,13 @@
import React, { Component } from 'react';
import { Dimensions, Platform, ActivityIndicator, View } from 'react-native';
import { QRCode as QRSlow } from 'react-native-custom-qr-codes';
-import { BlueSpacing40, SafeBlueArea, BlueNavigationStyle, BlueCard, BlueText } from '../../BlueComponents';
+import { BlueSpacing20, SafeBlueArea, BlueNavigationStyle, BlueText } from '../../BlueComponents';
import PropTypes from 'prop-types';
const QRFast = require('react-native-qrcode');
/** @type {AppStorage} */
let BlueApp = require('../../BlueApp');
let loc = require('../../loc');
const { height, width } = Dimensions.get('window');
-const aspectRatio = height / width;
-let isIpad;
-if (aspectRatio > 1.6) {
- isIpad = false;
-} else {
- isIpad = true;
-}
export default class WalletExport extends Component {
static navigationOptions = ({ navigation }) => ({
@@ -38,11 +31,12 @@ export default class WalletExport extends Component {
this.state = {
isLoading: true,
+ qrCodeHeight: height > width ? height / 2.5 : width / 2,
wallet,
};
}
- async componentDidMount() {
+ componentDidMount() {
this.setState({
isLoading: false,
showQr: false,
@@ -54,17 +48,15 @@ export default class WalletExport extends Component {
}, 1000);
}
- determineSize = () => {
- if (width > 312) {
- return width - 48;
- }
- return 312;
+ onLayout = () => {
+ const { height } = Dimensions.get('window');
+ this.setState({ qrCodeHeight: height > width ? height / 2.5 : width / 2 });
};
render() {
if (this.state.isLoading) {
return (
-
+
);
@@ -82,12 +74,7 @@ export default class WalletExport extends Component {
return (
- {(() => {
- if (isIpad) {
- return ;
- }
- })()}
-
+
{this.state.wallet.typeReadable}
@@ -101,14 +88,14 @@ export default class WalletExport extends Component {
);
}
})()}
-
+
{(() => {
if (this.state.showQr) {
if (Platform.OS === 'ios' || this.state.wallet.getSecret().length < 54) {
return (
@@ -133,9 +120,10 @@ export default class WalletExport extends Component {
);
}
})()}
+
- {this.state.wallet.getSecret()}
-
+ {this.state.wallet.getSecret()}
+
);
}
diff --git a/screen/wallets/xpub.js b/screen/wallets/xpub.js
index cb5b3aa8..edd0ba0c 100644
--- a/screen/wallets/xpub.js
+++ b/screen/wallets/xpub.js
@@ -1,20 +1,13 @@
import React, { Component } from 'react';
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, BlueNavigationStyle } from '../../BlueComponents';
+import { BlueSpacing20, SafeBlueArea, BlueText, BlueNavigationStyle } from '../../BlueComponents';
import PropTypes from 'prop-types';
const QRFast = require('react-native-qrcode');
/** @type {AppStorage} */
let BlueApp = require('../../BlueApp');
let loc = require('../../loc');
const { height, width } = Dimensions.get('window');
-const aspectRatio = height / width;
-let isIpad;
-if (aspectRatio > 1.6) {
- isIpad = false;
-} else {
- isIpad = true;
-}
export default class WalletXpub extends Component {
static navigationOptions = ({ navigation }) => ({
@@ -41,6 +34,7 @@ export default class WalletXpub extends Component {
wallet,
xpub: wallet.getXpub(),
xpubText: wallet.getXpub(),
+ qrCodeHeight: height > width ? height / 2.5 : width / 2,
};
}
@@ -55,13 +49,6 @@ export default class WalletXpub extends Component {
}, 1000);
}
- determineSize = () => {
- if (width > 312) {
- return width - 48;
- }
- return 312;
- };
-
copyToClipboard = () => {
this.setState({ xpubText: loc.wallets.xpub.copiedToClipboard }, () => {
Clipboard.setString(this.state.xpub);
@@ -69,6 +56,11 @@ export default class WalletXpub extends Component {
});
};
+ onLayout = () => {
+ const { height } = Dimensions.get('window');
+ this.setState({ qrCodeHeight: height > width ? height / 2.5 : width / 2 });
+ };
+
render() {
if (this.state.isLoading) {
return (
@@ -80,11 +72,11 @@ export default class WalletXpub extends Component {
return (
- {isIpad && }
-
+
{this.state.wallet.typeReadable}
+
{(() => {
if (this.state.showQr) {
@@ -92,10 +84,10 @@ export default class WalletXpub extends Component {
return (
);
@@ -103,9 +95,9 @@ export default class WalletXpub extends Component {
return (
);
}
@@ -117,13 +109,13 @@ export default class WalletXpub extends Component {
);
}
})()}
-
+
-
+
{this.state.xpubText}
-
+
);
}