Skip to content

Commit

Permalink
Fix routing for swap flow
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon-edge committed Oct 24, 2024
1 parent c63fe78 commit 01486e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/scenes/SwapSuccessScene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const SwapSuccessScene = (props: Props) => {
})

const handleTransactionDetails = useHandler(() => {
navigation.replace('transactionDetails', { edgeTransaction, walletId })
navigation.replace('transactionDetails', { edgeTransaction, walletId, onDone: handleDone })
})

useAsyncEffect(
Expand Down
7 changes: 5 additions & 2 deletions src/components/scenes/TransactionDetailsScene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,12 @@ interface Props extends EdgeSceneProps<'transactionDetails'> {
export interface TransactionDetailsParams {
edgeTransaction: EdgeTransaction
walletId: string
onDone?: () => void
}

const TransactionDetailsComponent = (props: Props) => {
const { navigation, route, wallet } = props
const { edgeTransaction: transaction, walletId } = route.params
const { edgeTransaction: transaction, walletId, onDone } = route.params
const { currencyCode, metadata, nativeAmount, date, txid, tokenId } = transaction
const { currencyInfo } = wallet

Expand Down Expand Up @@ -144,6 +145,8 @@ const TransactionDetailsComponent = (props: Props) => {
.catch(error => showError(error))
})

const handleDone = useHandler(() => (onDone == null ? navigation.pop() : onDone()))

// #endregion Crypto Fiat Rows

React.useEffect(() => {
Expand Down Expand Up @@ -413,7 +416,7 @@ const TransactionDetailsComponent = (props: Props) => {
<ButtonsView
layout="column"
primary={{
onPress: navigation.pop,
onPress: handleDone,
label: lstrings.string_done_cap
}}
parentType="scene"
Expand Down

0 comments on commit 01486e3

Please sign in to comment.