-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: copy & rename Receive's reusable step screens for new add a…
…ccount flow (#8377)
- Loading branch information
1 parent
c28f67d
commit e381081
Showing
19 changed files
with
1,673 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"live-mobile": minor | ||
--- | ||
|
||
Prepare add account v2 reusable screens |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
apps/ledger-live-mobile/src/newArch/features/Accounts/Navigator.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import React, { useCallback, useMemo } from "react"; | ||
import { Platform } from "react-native"; | ||
import { createStackNavigator } from "@react-navigation/stack"; | ||
import { useTheme } from "styled-components/native"; | ||
import { useRoute } from "@react-navigation/native"; | ||
import { ScreenName } from "~/const"; | ||
import { getStackNavigatorConfig } from "~/navigation/navigatorConfig"; | ||
import { track } from "~/analytics"; | ||
import type { NetworkBasedAddAccountNavigator } from "LLM/features/Accounts/screens/AddAccount/types"; | ||
import SelectAccounts from "LLM/features/Accounts/screens/SelectAccounts"; | ||
import { NavigationHeaderCloseButtonAdvanced } from "~/components/NavigationHeaderCloseButton"; | ||
import ScanDeviceAccounts from "LLM/features/Accounts/screens/ScanDeviceAccounts"; | ||
export default function Navigator() { | ||
const { colors } = useTheme(); | ||
const route = useRoute(); | ||
|
||
const onClose = useCallback(() => { | ||
track("button_clicked", { | ||
button: "Close", | ||
screen: route.name, | ||
}); | ||
}, [route]); | ||
|
||
const stackNavigationConfig = useMemo( | ||
() => ({ | ||
...getStackNavigatorConfig(colors, true), | ||
headerRight: () => <NavigationHeaderCloseButtonAdvanced onClose={onClose} />, | ||
}), | ||
[colors, onClose], | ||
); | ||
|
||
return ( | ||
<Stack.Navigator | ||
screenOptions={{ | ||
...stackNavigationConfig, | ||
gestureEnabled: Platform.OS === "ios", | ||
}} | ||
> | ||
{/* Select Accounts */} | ||
<Stack.Screen | ||
name={ScreenName.SelectAccounts} | ||
component={SelectAccounts} | ||
options={{ | ||
headerTitle: "", | ||
}} | ||
/> | ||
|
||
{/* Scan accounts from device */} | ||
<Stack.Screen | ||
name={ScreenName.ScanDeviceAccounts} | ||
component={ScanDeviceAccounts} | ||
options={{ | ||
headerTitle: "", | ||
}} | ||
/> | ||
</Stack.Navigator> | ||
); | ||
} | ||
|
||
const Stack = createStackNavigator<NetworkBasedAddAccountNavigator>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
apps/ledger-live-mobile/src/newArch/features/Accounts/screens/AddAccount/types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { CryptoCurrency, TokenCurrency } from "@ledgerhq/types-cryptoassets"; | ||
import { ScreenName } from "~/const"; | ||
import { Device } from "@ledgerhq/types-devices"; | ||
|
||
export type NetworkBasedAddAccountNavigator = { | ||
[ScreenName.SelectAccounts]: { | ||
currency: CryptoCurrency | TokenCurrency; | ||
createTokenAccount?: boolean; | ||
}; | ||
[ScreenName.ScanDeviceAccounts]: { | ||
currency: CryptoCurrency | TokenCurrency; | ||
device: Device; | ||
onSuccess?: (_?: unknown) => void; | ||
}; | ||
}; |
Oops, something went wrong.