Merge pull request #365 from lbryio/confirm-send-lbc
add confirmation dialog for sending LBC
This commit is contained in:
commit
6cc74488a3
1 changed files with 12 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
||||||
// @flow
|
// @flow
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { regexAddress } from 'lbry-redux';
|
import { regexAddress } from 'lbry-redux';
|
||||||
import { TextInput, Text, View } from 'react-native';
|
import { Alert, TextInput, Text, View } from 'react-native';
|
||||||
import Button from '../button';
|
import Button from '../button';
|
||||||
import walletStyle from '../../styles/wallet';
|
import walletStyle from '../../styles/wallet';
|
||||||
|
|
||||||
|
@ -52,8 +52,17 @@ class WalletSend extends React.PureComponent<Props> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (amount && address) {
|
if (amount && address) {
|
||||||
sendToAddress(address, parseFloat(amount));
|
// Show confirmation before send
|
||||||
this.setState({ address: null, amount: null });
|
Alert.alert(
|
||||||
|
'Send LBC',
|
||||||
|
`Are you sure you want to send ${amount} LBC to ${address}?`,
|
||||||
|
[
|
||||||
|
{ text: 'No' },
|
||||||
|
{ text: 'Yes', onPress: () => {
|
||||||
|
sendToAddress(address, parseFloat(amount));
|
||||||
|
this.setState({ address: null, amount: null });
|
||||||
|
}}
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue