diff options
author | brunobar79 <brunobar79@gmail.com> | 2018-07-25 08:32:20 +0800 |
---|---|---|
committer | brunobar79 <brunobar79@gmail.com> | 2018-07-25 08:32:20 +0800 |
commit | 74fd6d1d1227d7a9e49623b73ee85985d79a1e46 (patch) | |
tree | 0329696b64e9f300c05919729d87dbb0dbd99655 /ui/app/components/send/send.component.js | |
parent | d5929e5c42e230fc0a52337f86b5850e68516563 (diff) | |
download | tangerine-wallet-browser-74fd6d1d1227d7a9e49623b73ee85985d79a1e46.tar.gz tangerine-wallet-browser-74fd6d1d1227d7a9e49623b73ee85985d79a1e46.tar.zst tangerine-wallet-browser-74fd6d1d1227d7a9e49623b73ee85985d79a1e46.zip |
working without injection
Diffstat (limited to 'ui/app/components/send/send.component.js')
-rw-r--r-- | ui/app/components/send/send.component.js | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/ui/app/components/send/send.component.js b/ui/app/components/send/send.component.js index 6c439cd21..fb7eef329 100644 --- a/ui/app/components/send/send.component.js +++ b/ui/app/components/send/send.component.js @@ -39,16 +39,26 @@ export default class SendTransactionScreen extends PersistentForm { updateSendErrors: PropTypes.func, updateSendTokenBalance: PropTypes.func, scanQrCode: PropTypes.func, + qrCodeData: PropTypes.object, }; static contextTypes = { t: PropTypes.func, }; - scanQrCode = async () => { - const scannedAddress = await this.props.scanQrCode() - this.props.updateSendTo(scannedAddress) - this.updateGas({ to: scannedAddress }) + componentWillReceiveProps (nextProps) { + if (nextProps.qrCodeData) { + if (nextProps.qrCodeData.type === 'address') { + const scannedAddress = nextProps.qrCodeData.values.address.toLowerCase() + const currentAddress = this.props.to && this.props.to.toLowerCase() + if (currentAddress !== scannedAddress) { + this.props.updateSendTo(scannedAddress) + this.updateGas({ to: scannedAddress }) + + // Here we should clear props.qrCodeData + } + } + } } updateGas ({ to: updatedToAddress, amount: value } = {}) { @@ -179,7 +189,7 @@ export default class SendTransactionScreen extends PersistentForm { <SendHeader history={history}/> <SendContent updateGas={(updateData) => this.updateGas(updateData)} - scanQrCode={_ => this.scanQrCode()} + scanQrCode={_ => this.props.scanQrCode()} /> <SendFooter history={history}/> </div> |