Skip to content

Commit 04d6822

Browse files
committed
chore(nav): type wallet, asset, and settings shell navigators (Phase 3)
1 parent 4d571e3 commit 04d6822

2 files changed

Lines changed: 113 additions & 16 deletions

File tree

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
import type { NavigatorScreenParams } from '@react-navigation/native';
2+
import type { AssetViewParams } from '../../../Views/Asset/Asset.types';
3+
import type { TokenDetailsRouteParams } from '../../../UI/TokenDetails/constants/constants';
4+
import type {
5+
CreatePriceAlertRouteParams,
6+
PriceAlertRouteParams,
7+
} from '../../../UI/Assets/PriceAlerts/constants';
8+
import type { RevealPrivateCredentialParams } from '../../../Views/RevealPrivateCredential/RevealPrivateCredential.types';
9+
import type { NetworkDetailsViewParams } from '../../../Views/NetworksManagement/NetworkDetailsView/NetworkDetailsView.types';
10+
import type { ContactFormParams } from '../../../Views/Settings/Contacts/ContactForm.types';
11+
import type { NotificationSettingsSectionProps } from '../../../Views/Settings/NotificationsSettings/NotificationSettingsSection';
12+
import type { RegionSelectorParams } from '../../../Views/Modals/Modals.types';
13+
import type {
14+
ManualBackupStep1Params,
15+
ManualBackupStep2Params,
16+
} from '../../../Views/ManualBackupStep1/ManualBackupStep1.types';
17+
import type {
18+
AccountBackupParams,
19+
ManualBackupStep3Params,
20+
} from '../../../Views/AccountBackup/AccountBackup.types';
21+
22+
/**
23+
* Param list for screens inside `AssetStackFlow` (token details + alerts).
24+
*/
25+
// ParamListBase requires `type`; `interface` cannot satisfy it.
26+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
27+
export type AssetStackParamList = {
28+
Asset: AssetViewParams | undefined;
29+
SecurityTrust: TokenDetailsRouteParams & {
30+
isPricePositive?: boolean;
31+
useAmbientColor?: boolean;
32+
};
33+
CreatePriceAlert: CreatePriceAlertRouteParams;
34+
ManagePriceAlerts: PriceAlertRouteParams;
35+
};
36+
37+
/**
38+
* Param list for screens inside `WalletTabStackFlow`.
39+
*/
40+
// ParamListBase requires `type`; `interface` cannot satisfy it.
41+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
42+
export type WalletTabStackParamList = {
43+
WalletView: undefined;
44+
RevealPrivateCredential: RevealPrivateCredentialParams | undefined;
45+
};
46+
47+
/**
48+
* `WalletTabHome` is registered with component `WalletTabStackFlow`, but many
49+
* call sites still navigate with an intermediate `WalletTabStackFlow` screen.
50+
* Include both the real stack screens and that nested form.
51+
*/
52+
// ParamListBase requires `type`; `interface` cannot satisfy it.
53+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
54+
export type WalletTabHomeParamList = WalletTabStackParamList & {
55+
WalletTabStackFlow:
56+
| NavigatorScreenParams<WalletTabStackParamList>
57+
| undefined;
58+
};
59+
60+
/**
61+
* Param list for screens inside `SettingsFlow` (`SettingsView`).
62+
*/
63+
// ParamListBase requires `type`; `interface` cannot satisfy it.
64+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
65+
export type SettingsStackParamList = {
66+
AccountsMenuView: undefined;
67+
Settings: undefined;
68+
GeneralSettings: undefined;
69+
AdvancedSettings: { scrollToBottom?: boolean } | undefined;
70+
NetworksManagement: undefined;
71+
NetworkDetails: NetworkDetailsViewParams | undefined;
72+
SDKSessionsManager: undefined;
73+
SecuritySettings: undefined;
74+
RampSettings: undefined;
75+
RampActivationKeyForm: undefined;
76+
RampHeadlessPlayground: undefined;
77+
AesCryptoTestForm: undefined;
78+
ExperimentalSettings: undefined;
79+
CompanySettings: undefined;
80+
DeveloperOptions: undefined;
81+
ContactsSettings: undefined;
82+
ContactForm: ContactFormParams | undefined;
83+
RevealPrivateCredentialView: RevealPrivateCredentialParams | undefined;
84+
WalletConnectSessionsView: undefined;
85+
ResetPassword: undefined;
86+
WalletRecovery: undefined;
87+
AccountBackupStep1B: AccountBackupParams | undefined;
88+
ManualBackupStep1: ManualBackupStep1Params | undefined;
89+
ManualBackupStep2: ManualBackupStep2Params | undefined;
90+
ManualBackupStep3: ManualBackupStep3Params;
91+
EnterPasswordSimple: undefined;
92+
NotificationsSettings: undefined;
93+
NotificationSettingsSection: NotificationSettingsSectionProps['route']['params'];
94+
BackupAndSyncSettings: undefined;
95+
SettingsRegionSelector: RegionSelectorParams | undefined;
96+
SnapsSettingsList: undefined;
97+
};

app/core/NavigationService/types.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ import type { LedgerTransactionModalParams } from '../../components/UI/LedgerMod
1818
// Browser params
1919
import type { BrowserParams } from '../../components/Views/Browser/Browser.types';
2020
import type { ActivityDetailsParams } from '../../components/Views/ActivityDetails/ActivityDetails.types';
21+
import type {
22+
AssetStackParamList,
23+
SettingsStackParamList,
24+
WalletTabHomeParamList,
25+
WalletTabStackParamList,
26+
} from '../../components/Nav/Main/types/navigation';
2127

2228
// Bridge params
2329
import type { BatchSellTokenSelectRouteParams } from '../../components/UI/Bridge/Views/BatchSellTokenSelect/types';
@@ -115,11 +121,6 @@ import type {
115121
AssetViewParams,
116122
} from '../../components/Views/Asset/Asset.types';
117123
import type { NftDetailsParams } from '../../components/Views/NftDetails/NftDetails.types';
118-
import type { TokenDetailsRouteParams } from '../../components/UI/TokenDetails/constants/constants';
119-
import type {
120-
PriceAlertRouteParams,
121-
CreatePriceAlertRouteParams,
122-
} from '../../components/UI/Assets/PriceAlerts/constants';
123124

124125
// Stake params
125126
import type {
@@ -373,7 +374,7 @@ export type RootStackParamList = {
373374
WalletView: undefined;
374375
BrowserTabHome: BrowserParams | NestedNavigationParams | undefined;
375376
BrowserView: BrowserParams | undefined;
376-
SettingsView: NestedNavigationParams | undefined;
377+
SettingsView: NavigatorScreenParams<SettingsStackParamList> | undefined;
377378
DeprecatedNetworkDetails: undefined;
378379

379380
// Ramp routes
@@ -605,7 +606,7 @@ export type RootStackParamList = {
605606
Settings: undefined;
606607
ContactsSettings: undefined;
607608
CompanySettings: undefined;
608-
AdvancedSettings: undefined;
609+
AdvancedSettings: SettingsStackParamList['AdvancedSettings'];
609610
ResetPassword: undefined;
610611
ContactForm: ContactFormParams | undefined;
611612
DeveloperOptions: undefined;
@@ -685,8 +686,10 @@ export type RootStackParamList = {
685686
SimpleWebview: SimpleWebviewParams | undefined;
686687

687688
// Wallet routes
688-
WalletTabHome: NestedNavigationParams | undefined;
689-
WalletTabStackFlow: NestedNavigationParams | undefined;
689+
WalletTabHome: NavigatorScreenParams<WalletTabHomeParamList> | undefined;
690+
WalletTabStackFlow:
691+
| NavigatorScreenParams<WalletTabStackParamList>
692+
| undefined;
690693
WalletConnectSessionsView: undefined;
691694
DeFiFullView: undefined;
692695
NftFullView: undefined;
@@ -988,13 +991,10 @@ export type RootStackParamList = {
988991
ConfirmAddAsset: ConfirmAddAssetParams | undefined;
989992

990993
// Asset detail stack routes (nested under the `Asset` navigator)
991-
AssetStackFlow: NestedNavigationParams | undefined;
992-
SecurityTrust: TokenDetailsRouteParams & {
993-
isPricePositive?: boolean;
994-
useAmbientColor?: boolean;
995-
};
996-
CreatePriceAlert: CreatePriceAlertRouteParams;
997-
ManagePriceAlerts: PriceAlertRouteParams;
994+
AssetStackFlow: NavigatorScreenParams<AssetStackParamList> | undefined;
995+
SecurityTrust: AssetStackParamList['SecurityTrust'];
996+
CreatePriceAlert: AssetStackParamList['CreatePriceAlert'];
997+
ManagePriceAlerts: AssetStackParamList['ManagePriceAlerts'];
998998

999999
// NFT detail routes
10001000
NftDetails: NftDetailsParams;

0 commit comments

Comments
 (0)