diff --git a/src/__swaps__/screens/Swap/providers/swap-provider.tsx b/src/__swaps__/screens/Swap/providers/swap-provider.tsx index bbc534d55cc..42333c2a566 100644 --- a/src/__swaps__/screens/Swap/providers/swap-provider.tsx +++ b/src/__swaps__/screens/Swap/providers/swap-provider.tsx @@ -329,14 +329,21 @@ export const SwapProvider = ({ children }: SwapProviderProps) => { clearCustomGasSettings(chainId); NotificationManager?.postNotification('rapCompleted'); performanceTracking.getState().executeFn({ - fn: Navigation.handleAction, + fn: () => { + const { routes, index } = Navigation.getState(); + if (index === 0 || routes[index - 1].name === Routes.EXPANDED_ASSET_SHEET) { + Navigation.handleAction(Routes.WALLET_SCREEN, {}); + } else { + Navigation.goBack(); + } + }, screen: Screens.SWAPS, operation: TimeToSignOperation.SheetDismissal, endOfOperation: true, metadata: { degenMode: isDegenModeEnabled, }, - })(Routes.PROFILE_SCREEN, {}); + })(); analyticsV2.track(analyticsV2.event.swapsSubmitted, { type, diff --git a/src/navigation/Navigation.js b/src/navigation/Navigation.js index 03505cd2729..a1461bb567b 100644 --- a/src/navigation/Navigation.js +++ b/src/navigation/Navigation.js @@ -129,6 +129,7 @@ function setTopLevelNavigator(navigatorRef) { export default { getActiveOptions, + getState: () => TopLevelNavigationRef?.getState(), getActiveRoute, getActiveRouteName, handleAction,