Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix routing for swap flow #5324

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading