diff --git a/web/cashtab/src/components/Send/Send.js b/web/cashtab/src/components/Send/Send.js --- a/web/cashtab/src/components/Send/Send.js +++ b/web/cashtab/src/components/Send/Send.js @@ -1,4 +1,5 @@ import React, { useState, useEffect } from 'react'; +import { useLocation } from 'react-router-dom'; import PropTypes from 'prop-types'; import { WalletContext } from '@utils/context'; import { @@ -85,6 +86,7 @@ // If the wallet object from ContextValue has a `state key`, then check which keys are in the wallet object // Else set it as blank const ContextValue = React.useContext(WalletContext); + const location = useLocation(); const { wallet, fiatPrice, apiError, cashtabSettings } = ContextValue; const walletState = getWalletState(wallet); const { balances, slpBalancesAndUtxos } = walletState; @@ -144,6 +146,14 @@ useEffect(() => { // Manually parse for txInfo object on page load when Send.js is loaded with a query string + // if this was routed from Wallet screen's Reply to message link then prepopulate the address and value field + if (location && location.state && location.state.replyAddress) { + setFormData({ + address: location.state.replyAddress, + value: 5.5, + }); + } + // Do not set txInfo in state if query strings are not present if ( !window.location || @@ -583,37 +593,35 @@ style={{ marginBottom: '24px', }} + defaultActiveKey={ + location && + location.state && + location.state.replyAddress + ? ['1'] + : ['0'] + } > - -
- - - Message: - -