2018-01-30 22:42:38 +00:00
|
|
|
import React, { Component } from 'react';
|
2018-12-11 22:52:46 +00:00
|
|
|
import { TextInput, ScrollView, Linking, TouchableOpacity, Clipboard, StyleSheet, TouchableWithoutFeedback, Keyboard } from 'react-native';
|
2018-10-20 22:10:21 +01:00
|
|
|
import { Text } from 'react-native-elements';
|
2018-10-29 18:11:48 -04:00
|
|
|
import { BlueNavigationStyle, SafeBlueArea, BlueCard, BlueText } from '../../BlueComponents';
|
2018-03-18 02:48:23 +00:00
|
|
|
import PropTypes from 'prop-types';
|
2018-05-28 20:18:11 +01:00
|
|
|
let loc = require('../../loc');
|
2018-01-30 22:42:38 +00:00
|
|
|
|
|
|
|
export default class SendCreate extends Component {
|
2018-10-29 18:11:48 -04:00
|
|
|
static navigationOptions = () => ({
|
|
|
|
...BlueNavigationStyle,
|
|
|
|
title: loc.send.create.details,
|
|
|
|
});
|
|
|
|
|
2018-01-30 22:42:38 +00:00
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
2018-03-17 22:39:21 +02:00
|
|
|
console.log('send/create constructor');
|
2018-10-20 22:10:21 +01:00
|
|
|
|
2018-01-30 22:42:38 +00:00
|
|
|
this.state = {
|
2018-10-20 22:10:21 +01:00
|
|
|
isLoading: false,
|
2018-10-27 11:13:09 -04:00
|
|
|
amount: props.navigation.getParam('amount'),
|
|
|
|
fee: props.navigation.getParam('fee'),
|
|
|
|
address: props.navigation.getParam('address'),
|
|
|
|
memo: props.navigation.getParam('memo'),
|
2018-10-20 22:10:21 +01:00
|
|
|
size: Math.round(props.navigation.getParam('tx').length / 2),
|
|
|
|
tx: props.navigation.getParam('tx'),
|
|
|
|
satoshiPerByte: props.navigation.getParam('satoshiPerByte'),
|
2018-03-17 22:39:21 +02:00
|
|
|
};
|
2018-01-30 22:42:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
async componentDidMount() {
|
2018-03-17 22:39:21 +02:00
|
|
|
console.log('send/create - componentDidMount');
|
|
|
|
console.log('address = ', this.state.address);
|
2018-10-20 22:10:21 +01:00
|
|
|
}
|
2018-03-17 22:39:21 +02:00
|
|
|
|
2018-01-30 22:42:38 +00:00
|
|
|
render() {
|
2018-10-20 22:10:21 +01:00
|
|
|
return (
|
|
|
|
<SafeBlueArea style={{ flex: 1, paddingTop: 19 }}>
|
2018-12-11 22:52:46 +00:00
|
|
|
<TouchableWithoutFeedback onPress={Keyboard.dismiss} accessible={false}>
|
|
|
|
<ScrollView>
|
|
|
|
<BlueCard style={{ alignItems: 'center', flex: 1 }}>
|
|
|
|
<BlueText style={{ color: '#0c2550', fontWeight: '500' }}>{loc.send.create.this_is_hex}</BlueText>
|
|
|
|
<TextInput
|
|
|
|
style={{
|
|
|
|
borderColor: '#ebebeb',
|
|
|
|
backgroundColor: '#d2f8d6',
|
|
|
|
borderRadius: 4,
|
|
|
|
marginTop: 20,
|
|
|
|
color: '#37c0a1',
|
|
|
|
fontWeight: '500',
|
|
|
|
fontSize: 14,
|
|
|
|
paddingHorizontal: 16,
|
|
|
|
paddingBottom: 16,
|
|
|
|
paddingTop: 16,
|
|
|
|
}}
|
|
|
|
height={72}
|
|
|
|
multiline
|
|
|
|
editable
|
|
|
|
value={this.state.tx}
|
|
|
|
/>
|
2018-10-20 22:10:21 +01:00
|
|
|
|
2018-12-11 22:52:46 +00:00
|
|
|
<TouchableOpacity style={{ marginVertical: 24 }} onPress={() => Clipboard.setString(this.state.tx)}>
|
|
|
|
<Text style={{ color: '#9aa0aa', fontSize: 15, fontWeight: '500', alignSelf: 'center' }}>Copy and broadcast later</Text>
|
|
|
|
</TouchableOpacity>
|
|
|
|
<TouchableOpacity style={{ marginVertical: 24 }} onPress={() => Linking.openURL('https://coinb.in/?verify=' + this.state.tx)}>
|
|
|
|
<Text style={{ color: '#9aa0aa', fontSize: 15, fontWeight: '500', alignSelf: 'center' }}>Verify on coinb.in</Text>
|
|
|
|
</TouchableOpacity>
|
|
|
|
</BlueCard>
|
|
|
|
<BlueCard>
|
|
|
|
<Text style={styles.transactionDetailsTitle}>{loc.send.create.to}</Text>
|
|
|
|
<Text style={styles.transactionDetailsSubtitle}>{this.state.address}</Text>
|
2018-10-20 22:10:21 +01:00
|
|
|
|
2018-12-11 22:52:46 +00:00
|
|
|
<Text style={styles.transactionDetailsTitle}>{loc.send.create.amount}</Text>
|
|
|
|
<Text style={styles.transactionDetailsSubtitle}>{this.state.amount} BTC</Text>
|
2018-01-30 22:42:38 +00:00
|
|
|
|
2018-12-11 22:52:46 +00:00
|
|
|
<Text style={styles.transactionDetailsTitle}>{loc.send.create.fee}</Text>
|
|
|
|
<Text style={styles.transactionDetailsSubtitle}>{this.state.fee} BTC</Text>
|
2018-01-30 22:42:38 +00:00
|
|
|
|
2018-12-11 22:52:46 +00:00
|
|
|
<Text style={styles.transactionDetailsTitle}>{loc.send.create.tx_size}</Text>
|
|
|
|
<Text style={styles.transactionDetailsSubtitle}>{this.state.size} bytes</Text>
|
2018-08-18 23:10:12 +01:00
|
|
|
|
2018-12-11 22:52:46 +00:00
|
|
|
<Text style={styles.transactionDetailsTitle}>{loc.send.create.satoshi_per_byte}</Text>
|
|
|
|
<Text style={styles.transactionDetailsSubtitle}>{this.state.satoshiPerByte} Sat/B</Text>
|
2018-01-30 22:42:38 +00:00
|
|
|
|
2018-12-11 22:52:46 +00:00
|
|
|
<Text style={styles.transactionDetailsTitle}>{loc.send.create.memo}</Text>
|
|
|
|
<Text style={styles.transactionDetailsSubtitle}>{this.state.memo}</Text>
|
|
|
|
</BlueCard>
|
|
|
|
</ScrollView>
|
|
|
|
</TouchableWithoutFeedback>
|
2018-01-30 22:42:38 +00:00
|
|
|
</SafeBlueArea>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2018-03-18 02:48:23 +00:00
|
|
|
|
2018-10-20 22:10:21 +01:00
|
|
|
const styles = StyleSheet.create({
|
|
|
|
transactionDetailsTitle: {
|
|
|
|
color: '#0c2550',
|
|
|
|
fontWeight: '500',
|
|
|
|
fontSize: 17,
|
|
|
|
marginBottom: 2,
|
|
|
|
},
|
|
|
|
transactionDetailsSubtitle: {
|
|
|
|
color: '#9aa0aa',
|
|
|
|
fontWeight: '500',
|
|
|
|
fontSize: 15,
|
|
|
|
marginBottom: 20,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2018-03-18 02:48:23 +00:00
|
|
|
SendCreate.propTypes = {
|
|
|
|
navigation: PropTypes.shape({
|
|
|
|
goBack: PropTypes.function,
|
2018-10-20 22:10:21 +01:00
|
|
|
getParam: PropTypes.function,
|
|
|
|
navigate: PropTypes.function,
|
2018-10-27 11:13:09 -04:00
|
|
|
dismiss: PropTypes.function,
|
2018-03-18 02:48:23 +00:00
|
|
|
state: PropTypes.shape({
|
|
|
|
params: PropTypes.shape({
|
|
|
|
amount: PropTypes.string,
|
2018-10-20 22:10:21 +01:00
|
|
|
fee: PropTypes.number,
|
2018-03-18 02:48:23 +00:00
|
|
|
address: PropTypes.string,
|
|
|
|
memo: PropTypes.string,
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
};
|