2018-10-27 17:13:09 +02:00
|
|
|
import React, { Component } from 'react';
|
2018-12-11 23:52:46 +01:00
|
|
|
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
|
2018-10-27 17:13:09 +02:00
|
|
|
import { View } from 'react-native';
|
|
|
|
import { Text, Icon } from 'react-native-elements';
|
|
|
|
import { BlueButton, SafeBlueArea, BlueCard } from '../../BlueComponents';
|
|
|
|
import { BitcoinUnit } from '../../models/bitcoinUnits';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
let loc = require('../../loc');
|
|
|
|
|
|
|
|
export default class Success extends Component {
|
2018-10-29 23:11:48 +01:00
|
|
|
static navigationOptions = {
|
|
|
|
header: null,
|
|
|
|
};
|
|
|
|
|
2018-10-27 17:13:09 +02:00
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
console.log('send/create constructor');
|
|
|
|
|
|
|
|
this.state = {
|
|
|
|
amount: props.navigation.getParam('amount'),
|
2019-02-01 01:59:49 +01:00
|
|
|
fee: props.navigation.getParam('fee') || 0,
|
|
|
|
amountUnit: props.navigation.getParam('amountUnit') || BitcoinUnit.BTC,
|
2019-02-01 08:08:37 +01:00
|
|
|
invoiceDescription: props.navigation.getParam('invoiceDescription') || '',
|
2018-10-27 17:13:09 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
async componentDidMount() {
|
|
|
|
console.log('send/create - componentDidMount');
|
2019-05-03 14:36:11 +02:00
|
|
|
ReactNativeHapticFeedback.trigger('notificationSuccess', { ignoreAndroidSystemSettings: false });
|
2018-10-27 17:13:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<SafeBlueArea style={{ flex: 1, paddingTop: 19 }}>
|
|
|
|
<BlueCard style={{ alignItems: 'center', flex: 1 }}>
|
|
|
|
<View style={{ flexDirection: 'row', justifyContent: 'center', paddingTop: 76, paddingBottom: 16 }}>
|
|
|
|
<Text
|
|
|
|
style={{
|
|
|
|
color: '#0f5cc0',
|
|
|
|
fontSize: 36,
|
|
|
|
fontWeight: '600',
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{this.state.amount}
|
|
|
|
</Text>
|
|
|
|
<Text
|
|
|
|
style={{
|
|
|
|
color: '#0f5cc0',
|
|
|
|
fontSize: 16,
|
|
|
|
marginHorizontal: 4,
|
|
|
|
paddingBottom: 6,
|
|
|
|
fontWeight: '600',
|
|
|
|
alignSelf: 'flex-end',
|
|
|
|
}}
|
|
|
|
>
|
2019-02-01 01:59:49 +01:00
|
|
|
{' ' + this.state.amountUnit}
|
2018-10-27 17:13:09 +02:00
|
|
|
</Text>
|
|
|
|
</View>
|
2019-02-01 01:59:49 +01:00
|
|
|
{this.state.fee > 0 && (
|
|
|
|
<Text
|
|
|
|
style={{
|
|
|
|
color: '#37c0a1',
|
|
|
|
fontSize: 14,
|
|
|
|
marginHorizontal: 4,
|
|
|
|
paddingBottom: 6,
|
|
|
|
fontWeight: '500',
|
|
|
|
alignSelf: 'center',
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{loc.send.create.fee}: {loc.formatBalance(this.state.fee, BitcoinUnit.SATS)}
|
|
|
|
</Text>
|
2019-02-01 08:08:37 +01:00
|
|
|
)}
|
|
|
|
{this.state.fee <= 0 && (
|
|
|
|
<Text
|
|
|
|
numberOfLines={0}
|
|
|
|
style={{
|
|
|
|
color: '#37c0a1',
|
|
|
|
fontSize: 14,
|
|
|
|
marginHorizontal: 4,
|
|
|
|
paddingBottom: 6,
|
|
|
|
fontWeight: '500',
|
|
|
|
alignSelf: 'center',
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{this.state.invoiceDescription}
|
|
|
|
</Text>
|
2019-02-01 01:59:49 +01:00
|
|
|
)}
|
2018-10-27 17:13:09 +02:00
|
|
|
</BlueCard>
|
|
|
|
<View
|
|
|
|
style={{
|
|
|
|
backgroundColor: '#ccddf9',
|
|
|
|
width: 120,
|
|
|
|
height: 120,
|
|
|
|
borderRadius: 60,
|
|
|
|
alignSelf: 'center',
|
|
|
|
justifyContent: 'center',
|
|
|
|
marginTop: 43,
|
|
|
|
marginBottom: 53,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<Icon name="check" size={50} type="font-awesome" color="#0f5cc0" />
|
|
|
|
</View>
|
|
|
|
<BlueCard>
|
|
|
|
<BlueButton
|
|
|
|
onPress={() => {
|
2018-10-29 23:11:48 +01:00
|
|
|
this.props.navigation.dismiss();
|
2018-10-27 17:13:09 +02:00
|
|
|
}}
|
|
|
|
title={loc.send.success.done}
|
|
|
|
/>
|
|
|
|
</BlueCard>
|
|
|
|
</SafeBlueArea>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Success.propTypes = {
|
|
|
|
navigation: PropTypes.shape({
|
2019-02-01 16:28:43 +01:00
|
|
|
goBack: PropTypes.func,
|
|
|
|
getParam: PropTypes.func,
|
|
|
|
navigate: PropTypes.func,
|
|
|
|
dismiss: PropTypes.func,
|
2018-10-27 17:13:09 +02:00
|
|
|
state: PropTypes.shape({
|
|
|
|
params: PropTypes.shape({
|
2019-02-17 02:22:14 +01:00
|
|
|
amount: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
2018-10-27 17:13:09 +02:00
|
|
|
fee: PropTypes.number,
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
};
|