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

completing a swap navigates back to previous screen #6207

Merged
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 9 additions & 2 deletions src/__swaps__/screens/Swap/providers/swap-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (routes[index - 1].name === 'ExpandedAssetSheet') {
greg-schrammel marked this conversation as resolved.
Show resolved Hide resolved
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,
Expand Down
1 change: 1 addition & 0 deletions src/navigation/Navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ function setTopLevelNavigator(navigatorRef) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vote to migrate this to ts since Im here

export default {
getActiveOptions,
getState: () => TopLevelNavigationRef?.getState(),
getActiveRoute,
getActiveRouteName,
handleAction,
Expand Down
Loading