From cbac38571cb3506f4d7ceafe4673b48b5a9318fd Mon Sep 17 00:00:00 2001 From: Martin CAYUELAS <112866305+mcayuelas-ledger@users.noreply.github.com> Date: Wed, 18 Sep 2024 10:22:23 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Fix=20Blank=20account=20s?= =?UTF-8?q?creen=20when=20removing=20account=20from=20LLD=20when=20LS=20ac?= =?UTF-8?q?tivated=20(#7826)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/shy-ducks-sparkle.md | 5 ++++ .../src/screens/Account/index.tsx | 27 ++++++++++++++++--- 2 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 .changeset/shy-ducks-sparkle.md diff --git a/.changeset/shy-ducks-sparkle.md b/.changeset/shy-ducks-sparkle.md new file mode 100644 index 000000000000..2ac2d1790ae0 --- /dev/null +++ b/.changeset/shy-ducks-sparkle.md @@ -0,0 +1,5 @@ +--- +"live-mobile": patch +--- + +Fix Blank account screen when removing account from LLD when LS activated diff --git a/apps/ledger-live-mobile/src/screens/Account/index.tsx b/apps/ledger-live-mobile/src/screens/Account/index.tsx index 377a4bfdb620..b09692f392e6 100644 --- a/apps/ledger-live-mobile/src/screens/Account/index.tsx +++ b/apps/ledger-live-mobile/src/screens/Account/index.tsx @@ -1,4 +1,4 @@ -import React, { useState, useCallback } from "react"; +import React, { useState, useCallback, useEffect } from "react"; import { FlatList, LayoutChangeEvent, ListRenderItemInfo } from "react-native"; import Animated, { useAnimatedScrollHandler, useSharedValue } from "react-native-reanimated"; import { useDispatch, useSelector } from "react-redux"; @@ -23,7 +23,7 @@ import { import { accountScreenSelector } from "~/reducers/accounts"; import { track, TrackScreen } from "~/analytics"; import accountSyncRefreshControl from "~/components/accountSyncRefreshControl"; -import { ScreenName } from "~/const"; +import { NavigatorName, ScreenName } from "~/const"; import CurrencyBackgroundGradient from "~/components/CurrencyBackgroundGradient"; import AccountHeader from "./AccountHeader"; import { getListHeaderComponents } from "./ListHeaderComponent"; @@ -35,7 +35,11 @@ import EmptyAccountCard from "./EmptyAccountCard"; import useAccountActions from "./hooks/useAccountActions"; import type { AccountsNavigatorParamList } from "~/components/RootNavigator/types/AccountsNavigator"; import type { BaseNavigatorStackParamList } from "~/components/RootNavigator/types/BaseNavigator"; -import type { StackNavigatorProps } from "~/components/RootNavigator/types/helpers"; +import type { + RootNavigationComposite, + StackNavigatorNavigation, + StackNavigatorProps, +} from "~/components/RootNavigator/types/helpers"; import { getCurrencyConfiguration } from "@ledgerhq/live-common/config/index"; import { CurrencyConfig } from "@ledgerhq/coin-framework/config"; @@ -50,7 +54,22 @@ const AnimatedFlatListWithRefreshControl = Animated.createAnimatedComponent( /** If deep linking params are present, this Account Screen is redirected to from Accounts Screen. */ function AccountScreen({ route }: Props) { const { account, parentAccount } = useSelector(accountScreenSelector(route)); - + const navigation = + useNavigation>>(); + + useEffect(() => { + if (!account) { + navigation.navigate(NavigatorName.Base, { + screen: NavigatorName.Main, + params: { + screen: NavigatorName.Portfolio, + params: { + screen: NavigatorName.WalletTab, + }, + }, + }); + } + }, [account, navigation]); if (!account) return null; return ;