Skip to content

Commit

Permalink
Add type annotatons to router components
Browse files Browse the repository at this point in the history
With this change, we now verify that the scenes inside a router match what the router expects. This also gives us type checking for when we navigate to a scene nested within a router.

Unfortunately, we still have the `NavigationBase` type in the app which doesn't properly distinguish between the different types of navigation objects and their varying capabilities. This needs to be fixed.
  • Loading branch information
swansontec committed Sep 19, 2024
1 parent c84ff57 commit a0234f7
Show file tree
Hide file tree
Showing 8 changed files with 226 additions and 181 deletions.
13 changes: 11 additions & 2 deletions src/actions/LoginActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ export function initializeAccount(navigation: NavigationBase, account: EdgeAccou
// during account creation
await readLocalAccountSettings(account)

const newAccountFlow = async (navigation: NavigationProp<'createWalletSelectCrypto'>, items: WalletCreateItem[]) => {
const newAccountFlow = async (
navigation: NavigationProp<'createWalletSelectCrypto' | 'createWalletSelectCryptoNewAccount'>,
items: WalletCreateItem[]
) => {
navigation.replace('edgeTabs', { screen: 'home' })
const createWalletsPromise = createCustomWallets(account, fiatCurrencyCode, items, dispatch).catch(error => showError(error))

Expand Down Expand Up @@ -114,7 +117,13 @@ export function initializeAccount(navigation: NavigationBase, account: EdgeAccou

performance.mark('loginEnd', { detail: { isNewAccount: newAccount } })
} else {
rootNavigation.replace('edgeApp', {})
rootNavigation.replace('edgeApp', {
screen: 'edgeAppStack',
params: {
screen: 'edgeTabs',
params: { screen: 'home' }
}
})
referralPromise.catch(() => console.log(`Failed to load account referral info`))

performance.mark('loginEnd', { detail: { isNewAccount: newAccount } })
Expand Down
Loading

0 comments on commit a0234f7

Please sign in to comment.