import React, { Component } from 'react';
import { Dimensions, View } from 'react-native';
import QRCode from 'react-native-qrcode';
import {
BlueLoading,
BlueFormInputAddress,
SafeBlueArea,
BlueCard,
BlueHeaderDefaultSub,
BlueSpacing,
BlueSpacing40,
} from '../../BlueComponents';
import PropTypes from 'prop-types';
/** @type {AppStorage} */
let BlueApp = require('../../BlueApp');
let loc = require('../../loc');
let EV = require('../../events');
const { height, width } = Dimensions.get('window');
const aspectRatio = height / width;
let isIpad;
if (aspectRatio > 1.6) {
isIpad = false;
} else {
isIpad = true;
}
export default class ReceiveDetails extends Component {
static navigationOptions = {
tabBarVisible: false,
};
constructor(props) {
super(props);
let address = props.navigation.state.params.address;
this.state = {
isLoading: true,
address: address,
};
console.log(JSON.stringify(address));
EV(EV.enum.RECEIVE_ADDRESS_CHANGED, this.refreshFunction.bind(this));
}
refreshFunction(newAddress) {
console.log('newAddress =', newAddress);
this.setState({
address: newAddress,
});
}
async componentDidMount() {
console.log('receive/details - componentDidMount');
this.setState({
isLoading: false,
});
}
render() {
console.log('render() receive/details, address=', this.state.address);
if (this.state.isLoading) {
return ;
}
return (
{(() => {
if (isIpad) {
return ;
} else {
return ;
}
})()}
this.props.navigation.goBack()}
/>
);
}
}
ReceiveDetails.propTypes = {
navigation: PropTypes.shape({
goBack: PropTypes.function,
state: PropTypes.shape({
params: PropTypes.shape({
address: PropTypes.string,
}),
}),
}),
};