diff --git a/e2e/backup.e2e.js b/e2e/backup.e2e.js index ba0b717f4..7c8645e53 100644 --- a/e2e/backup.e2e.js +++ b/e2e/backup.e2e.js @@ -91,7 +91,7 @@ d('Backup', () => { await element(by.id('NavigationClose')).atIndex(0).tap(); // remove 2 default widgets, leave PriceWidget - await element(by.id('WalletsScrollView')).scroll(200, 'down', 0); + await element(by.id('HomeScrollView')).scroll(200, 'down', 0); await element(by.id('WidgetsEdit')).tap(); for (const w of ['NewsWidget', 'BlocksWidget']) { await element(by.id('WidgetActionDelete').withAncestor(by.id(w))).tap(); @@ -121,7 +121,7 @@ d('Backup', () => { await sleep(200); // animation // check widgets - await element(by.id('WalletsScrollView')).scroll(300, 'down', 0); + await element(by.id('HomeScrollView')).scroll(300, 'down', 0); await expect(element(by.id('PriceWidget'))).toExist(); await expect(element(by.id('NewsWidget'))).not.toExist(); await expect(element(by.id('BlocksWidget'))).not.toExist(); diff --git a/e2e/boost.e2e.js b/e2e/boost.e2e.js index 7520fdebc..1a23f1fd4 100644 --- a/e2e/boost.e2e.js +++ b/e2e/boost.e2e.js @@ -96,7 +96,7 @@ d('Boost', () => { await element(by.id('Close')).tap(); // check Activity - await element(by.id('WalletsScrollView')).scrollTo('bottom', 0); + await element(by.id('HomeScrollView')).scrollTo('bottom', 0); await expect(element(by.id('ActivityShort-1'))).toBeVisible(); await expect( element(by.text('100 000').withAncestor(by.id('ActivityShort-2'))), @@ -207,7 +207,7 @@ d('Boost', () => { await element(by.id('Close')).tap(); // check Activity - await element(by.id('WalletsScrollView')).scrollTo('bottom', 0); + await element(by.id('HomeScrollView')).scrollTo('bottom', 0); await expect(element(by.id('ActivityShort-1'))).toBeVisible(); await expect( element(by.text('100 000').withAncestor(by.id('ActivityShort-2'))), @@ -273,7 +273,7 @@ d('Boost', () => { await restoreWallet(seed); // check activity after restore - await element(by.id('WalletsScrollView')).scrollTo('bottom', 0); + await element(by.id('HomeScrollView')).scrollTo('bottom', 0); await expect(element(by.id('BoostingIcon'))).toBeVisible(); await element(by.id('ActivityShort-1')).tap(); await expect(element(by.id('BoostedButton'))).toBeVisible(); diff --git a/e2e/lightning.e2e.js b/e2e/lightning.e2e.js index be0a847cc..bb0c344f5 100644 --- a/e2e/lightning.e2e.js +++ b/e2e/lightning.e2e.js @@ -230,7 +230,7 @@ d('Lightning', () => { .withTimeout(10000); // check tx history - await element(by.id('WalletsScrollView')).scroll(1000, 'down', 0); + await element(by.id('HomeScrollView')).scroll(1000, 'down', 0); await expect( element(by.text('1 000').withAncestor(by.id('ActivityShort-1'))), ).toBeVisible(); @@ -322,7 +322,7 @@ d('Lightning', () => { .withTimeout(10000); // check tx history - await element(by.id('WalletsScrollView')).scroll(1000, 'down', 0); + await element(by.id('HomeScrollView')).scroll(1000, 'down', 0); await expect( element(by.text('111').withAncestor(by.id('ActivityShort-2'))), ).toBeVisible(); diff --git a/e2e/lnurl.e2e.js b/e2e/lnurl.e2e.js index b870cdb5e..4b6e9c477 100644 --- a/e2e/lnurl.e2e.js +++ b/e2e/lnurl.e2e.js @@ -195,7 +195,7 @@ d('LNURL', () => { .withTimeout(10000); await element(by.id('Close')).tap(); // check if comment is displayed - await element(by.id('WalletsScrollView')).scrollTo('bottom', 0); + await element(by.id('HomeScrollView')).scrollTo('bottom', 0); await element(by.id('ActivityShort-1')).tap(); await expect(element(by.id('InvoiceComment'))).toHaveText('test comment'); await element(by.id('NavigationClose')).tap(); diff --git a/e2e/onchain.e2e.js b/e2e/onchain.e2e.js index f63ee85af..0a32d7931 100644 --- a/e2e/onchain.e2e.js +++ b/e2e/onchain.e2e.js @@ -140,7 +140,7 @@ d('Onchain', () => { ).toHaveText('0'); // check Activity - await element(by.id('WalletsScrollView')).scroll(1000, 'down', 0); + await element(by.id('HomeScrollView')).scroll(1000, 'down', 0); await expect(element(by.id('ActivityShort-1'))).toBeVisible(); await expect(element(by.id('ActivityShort-2'))).toBeVisible(); await expect(element(by.id('ActivityShort-3'))).toBeVisible(); @@ -306,7 +306,7 @@ d('Onchain', () => { ).toHaveText('0'); // check number of outputs for send tx - await element(by.id('WalletsScrollView')).scroll(1000, 'down', 0); + await element(by.id('HomeScrollView')).scroll(1000, 'down', 0); await expect(element(by.id('ActivityShort-1'))).toBeVisible(); await expect(element(by.id('ActivityShort-2'))).toBeVisible(); await element(by.id('ActivityShowAll')).tap(); diff --git a/e2e/transfer.e2e.js b/e2e/transfer.e2e.js index d2191f67b..f034e2aec 100644 --- a/e2e/transfer.e2e.js +++ b/e2e/transfer.e2e.js @@ -214,7 +214,7 @@ d('Transfer', () => { await expect(element(by.id('Suggestion-lightningSettingUp'))).toBeVisible(); // check activity after restore - await element(by.id('WalletsScrollView')).scrollTo('bottom', 0); + await element(by.id('HomeScrollView')).scrollTo('bottom', 0); await element(by.id('ActivityShort-1')).tap(); await expect(element(by.id('StatusTransfer'))).toBeVisible(); @@ -235,7 +235,7 @@ d('Transfer', () => { await restoreWallet(seed); // check activity after restore - await element(by.id('WalletsScrollView')).scrollTo('bottom', 0); + await element(by.id('HomeScrollView')).scrollTo('bottom', 0); await expect(element(by.id('BoostingIcon'))).toBeVisible(); await element(by.id('ActivityShort-1')).tap(); await expect(element(by.id('StatusBoosting'))).toBeVisible(); @@ -327,7 +327,7 @@ d('Transfer', () => { await expect(element(by.id('Suggestion-lightningSettingUp'))).toBeVisible(); // check activity - await element(by.id('WalletsScrollView')).scrollTo('bottom', 0); + await element(by.id('HomeScrollView')).scrollTo('bottom', 0); await expect(element(by.text('From Savings (±30m)'))).toBeVisible(); await element(by.id('ActivityShort-1')).tap(); await expect(element(by.text('Transfer (±30m)'))).toBeVisible(); diff --git a/e2e/widgets.e2e.js b/e2e/widgets.e2e.js index a042e13fa..f8a74b8a8 100644 --- a/e2e/widgets.e2e.js +++ b/e2e/widgets.e2e.js @@ -35,7 +35,7 @@ d('Widgets', () => { } // add price widget - await element(by.id('WalletsScrollView')).scroll(300, 'down', 0); + await element(by.id('HomeScrollView')).scroll(300, 'down', 0); await element(by.id('WidgetsAdd')).tap(); await element(by.id('WidgetsOnboarding-button')).tap(); await element(by.id('WidgetListItem-price')).tap(); @@ -50,7 +50,7 @@ d('Widgets', () => { await element(by.id('WidgetEditField-showSource')).tap(); await element(by.id('WidgetEditPreview')).tap(); await element(by.id('WidgetSave')).tap(); - await element(by.id('WalletsScrollView')).scroll(200, 'down', 0); + await element(by.id('HomeScrollView')).scroll(200, 'down', 0); await expect(element(by.id('PriceWidget'))).toBeVisible(); await expect(element(by.id('PriceWidgetRow-BTC/EUR'))).toBeVisible(); await expect(element(by.id('PriceWidgetSource'))).toBeVisible(); diff --git a/src/components/NavigationHeader.tsx b/src/components/NavigationHeader.tsx index 6a144f7f8..928a8d7b4 100644 --- a/src/components/NavigationHeader.tsx +++ b/src/components/NavigationHeader.tsx @@ -94,7 +94,7 @@ const NavigationHeader = ({ if (hasWalletRoute || parent) { // for nested navigators, pop to top of parent navigator - navigation.popTo('Wallet', { screen: 'Wallets' }); + navigation.popTo('Wallet', { screen: 'Home' }); } else { navigation.popToTop(); } diff --git a/src/components/TabBar.tsx b/src/components/TabBar.tsx index 6f60a0f47..828b81cb5 100644 --- a/src/components/TabBar.tsx +++ b/src/components/TabBar.tsx @@ -7,7 +7,7 @@ import { StyleSheet, ViewStyle, } from 'react-native'; -import { FadeIn } from 'react-native-reanimated'; +import Animated, { FadeIn } from 'react-native-reanimated'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { receiveIcon, sendIcon } from '../assets/icons/tabs'; @@ -18,8 +18,8 @@ import type { RootNavigationProp } from '../navigation/types'; import { resetSendTransaction } from '../store/actions/wallet'; import { spendingOnboardingSelector } from '../store/reselect/aggregations'; import { viewControllersSelector } from '../store/reselect/ui'; +import { TViewController } from '../store/types/ui'; import { toggleBottomSheet } from '../store/utils/ui'; -import { AnimatedView } from '../styles/components'; import { ScanIcon } from '../styles/icons'; import ButtonBlur from './buttons/ButtonBlur'; @@ -35,8 +35,15 @@ const TabBar = ({ const isSpendingOnboarding = useAppSelector(spendingOnboardingSelector); const shouldHide = useMemo(() => { - const activityFilterSheets = ['timeRangePrompt', 'tagsPrompt']; - return activityFilterSheets.some((view) => viewControllers[view].isOpen); + const viewControllerKeys: TViewController[] = [ + 'backupPrompt', + 'PINNavigation', + 'highBalance', + 'appUpdatePrompt', + 'timeRangePrompt', + 'tagsPrompt', + ]; + return viewControllerKeys.some((view) => viewControllers[view].isOpen); }, [viewControllers]); const onReceivePress = (): void => { @@ -73,19 +80,16 @@ const TabBar = ({ return Platform.OS === 'android' ? androidStyles : iosStyles; }, [white10]); - const bottom = useMemo(() => Math.max(insets.bottom, 16), [insets.bottom]); - const sendXml = useMemo(() => sendIcon('white'), []); - const receiveXml = useMemo(() => receiveIcon('white'), []); + const bottom = Math.max(insets.bottom, 16); + const sendXml = sendIcon('white'); + const receiveXml = receiveIcon('white'); if (shouldHide) { return <>; } return ( - + - + ); }; diff --git a/src/navigation/bottom-sheet/AppUpdatePrompt.tsx b/src/navigation/bottom-sheet/AppUpdatePrompt.tsx index 97f52ebc8..19e845302 100644 --- a/src/navigation/bottom-sheet/AppUpdatePrompt.tsx +++ b/src/navigation/bottom-sheet/AppUpdatePrompt.tsx @@ -26,7 +26,7 @@ const imageSrc = require('../../assets/illustrations/wand.png'); const ASK_INTERVAL = 1000 * 60 * 60 * 12; // 12h - how long this prompt will be hidden if user taps Later const CHECK_DELAY = 2500; // how long user needs to stay on Wallets screen before he will see this prompt -const AppUpdatePrompt = ({ enabled }: { enabled: boolean }): ReactElement => { +const AppUpdatePrompt = (): ReactElement => { const { t } = useTranslation('other'); const snapPoints = useSnapPoints('large'); const dispatch = useAppDispatch(); @@ -50,14 +50,13 @@ const AppUpdatePrompt = ({ enabled }: { enabled: boolean }): ReactElement => { const shouldShowBottomSheet = useMemo(() => { const isTimeoutOver = Number(new Date()) - ignoreTimestamp > ASK_INTERVAL; return ( - enabled && !__E2E__ && updateInfo !== null && !updateInfo.critical && isTimeoutOver && !anyBottomSheetIsOpen ); - }, [enabled, updateInfo, ignoreTimestamp, anyBottomSheetIsOpen]); + }, [updateInfo, ignoreTimestamp, anyBottomSheetIsOpen]); useEffect(() => { if (!shouldShowBottomSheet) { @@ -104,6 +103,7 @@ const AppUpdatePrompt = ({ enabled }: { enabled: boolean }): ReactElement => { } description={t('update_text')} image={imageSrc} + showBackButton={false} continueText={t('update_button')} cancelText={t('cancel')} testID="AppUpdatePrompt" diff --git a/src/screens/Settings/Backup/BackupPrompt.tsx b/src/navigation/bottom-sheet/BackupPrompt.tsx similarity index 67% rename from src/screens/Settings/Backup/BackupPrompt.tsx rename to src/navigation/bottom-sheet/BackupPrompt.tsx index 5d6594de9..ccbd6fa1b 100644 --- a/src/screens/Settings/Backup/BackupPrompt.tsx +++ b/src/navigation/bottom-sheet/BackupPrompt.tsx @@ -1,30 +1,30 @@ import React, { memo, ReactElement, useMemo, useEffect } from 'react'; import { Trans, useTranslation } from 'react-i18next'; -import BottomSheetScreen from '../../../components/BottomSheetScreen'; -import BottomSheetWrapper from '../../../components/BottomSheetWrapper'; -import { __E2E__ } from '../../../constants/env'; +import BottomSheetScreen from '../../components/BottomSheetScreen'; +import BottomSheetWrapper from '../../components/BottomSheetWrapper'; +import { __E2E__ } from '../../constants/env'; import { useBottomSheetBackPress, useSnapPoints, -} from '../../../hooks/bottomSheet'; -import { useAppDispatch, useAppSelector } from '../../../hooks/redux'; -import { useBalance } from '../../../hooks/wallet'; -import { viewControllersSelector } from '../../../store/reselect/ui'; -import { backupVerifiedSelector } from '../../../store/reselect/user'; -import { ignoreBackupTimestampSelector } from '../../../store/reselect/user'; -import { closeSheet } from '../../../store/slices/ui'; -import { ignoreBackup } from '../../../store/slices/user'; -import { showBottomSheet } from '../../../store/utils/ui'; -import { Display } from '../../../styles/text'; -import { objectKeys } from '../../../utils/objectKeys'; +} from '../../hooks/bottomSheet'; +import { useAppDispatch, useAppSelector } from '../../hooks/redux'; +import { useBalance } from '../../hooks/wallet'; +import { viewControllersSelector } from '../../store/reselect/ui'; +import { backupVerifiedSelector } from '../../store/reselect/user'; +import { ignoreBackupTimestampSelector } from '../../store/reselect/user'; +import { closeSheet } from '../../store/slices/ui'; +import { ignoreBackup } from '../../store/slices/user'; +import { showBottomSheet } from '../../store/utils/ui'; +import { Display } from '../../styles/text'; +import { objectKeys } from '../../utils/objectKeys'; -const imageSrc = require('../../../assets/illustrations/safe.png'); +const imageSrc = require('../../assets/illustrations/safe.png'); const ASK_INTERVAL = 1000 * 60 * 60 * 24; // 1 day - how long this prompt will be hidden if user taps Later const CHECK_DELAY = 2000; // how long user needs to stay on Wallets screen before he will see this prompt -const BackupPrompt = ({ enabled }: { enabled: boolean }): ReactElement => { +const BackupPrompt = (): ReactElement => { const { t } = useTranslation('security'); const snapPoints = useSnapPoints('medium'); const dispatch = useAppDispatch(); @@ -60,20 +60,13 @@ const BackupPrompt = ({ enabled }: { enabled: boolean }): ReactElement => { const shouldShowBottomSheet = useMemo(() => { const isTimeoutOver = Number(new Date()) - ignoreTimestamp > ASK_INTERVAL; return ( - enabled && !__E2E__ && !backupVerified && totalBalance > 0 && isTimeoutOver && !anyBottomSheetIsOpen ); - }, [ - enabled, - backupVerified, - totalBalance, - ignoreTimestamp, - anyBottomSheetIsOpen, - ]); + }, [backupVerified, totalBalance, ignoreTimestamp, anyBottomSheetIsOpen]); useEffect(() => { if (!shouldShowBottomSheet) { @@ -89,10 +82,7 @@ const BackupPrompt = ({ enabled }: { enabled: boolean }): ReactElement => { }; }, [shouldShowBottomSheet]); - const text = useMemo( - () => t(totalBalance > 0 ? 'backup_funds' : 'backup_funds_no'), - [totalBalance, t], - ); + const text = totalBalance > 0 ? t('backup_funds') : t('backup_funds_no'); return ( { } description={text} image={imageSrc} + showBackButton={false} continueText={t('backup_button')} cancelText={t('later')} testID="BackupPrompt" diff --git a/src/navigation/bottom-sheet/ConnectionClosed.tsx b/src/navigation/bottom-sheet/ConnectionClosed.tsx index 81e87e6c6..4b011e6cb 100644 --- a/src/navigation/bottom-sheet/ConnectionClosed.tsx +++ b/src/navigation/bottom-sheet/ConnectionClosed.tsx @@ -30,7 +30,10 @@ const ConnectionClosed = (): ReactElement => { return ( - + {t('connection_closed.description')} @@ -54,7 +57,7 @@ const ConnectionClosed = (): ReactElement => { const styles = StyleSheet.create({ container: { flex: 1, - marginHorizontal: 32, + marginHorizontal: 16, }, imageContainer: { flexShrink: 1, diff --git a/src/navigation/bottom-sheet/HighBalanceWarning.tsx b/src/navigation/bottom-sheet/HighBalanceWarning.tsx index 7ae00345e..63fc0fa2a 100644 --- a/src/navigation/bottom-sheet/HighBalanceWarning.tsx +++ b/src/navigation/bottom-sheet/HighBalanceWarning.tsx @@ -31,11 +31,7 @@ const BALANCE_THRESHOLD_SATS = 700000; // how high the balance must be to show t const ASK_INTERVAL = 1000 * 60 * 60 * 24; // 1 day - how long this prompt will be hidden if user taps Later const CHECK_DELAY = 3000; // how long user needs to stay on Wallets screen before he will see this prompt -const HighBalanceWarning = ({ - enabled, -}: { - enabled: boolean; -}): ReactElement => { +const HighBalanceWarning = (): ReactElement => { const { t } = useTranslation('other'); const { totalBalance } = useBalance(); const snapPoints = useSnapPoints('large'); @@ -74,21 +70,13 @@ const HighBalanceWarning = ({ const belowMaxWarnings = count < MAX_WARNINGS; const isTimeoutOver = Number(new Date()) - ignoreTimestamp > ASK_INTERVAL; return ( - enabled && !__E2E__ && thresholdReached && belowMaxWarnings && isTimeoutOver && !anyBottomSheetIsOpen ); - }, [ - enabled, - fiatValue, - totalBalance, - count, - ignoreTimestamp, - anyBottomSheetIsOpen, - ]); + }, [fiatValue, totalBalance, count, ignoreTimestamp, anyBottomSheetIsOpen]); useEffect(() => { if (!shouldShowBottomSheet) { @@ -137,6 +125,7 @@ const HighBalanceWarning = ({ /> } image={imageSrc} + showBackButton={false} continueText={t('high_balance.continue')} cancelText={t('high_balance.cancel')} testID="HighBalance" diff --git a/src/navigation/bottom-sheet/QuickPayPrompt.tsx b/src/navigation/bottom-sheet/QuickPayPrompt.tsx index 527cc7055..2f7a12473 100644 --- a/src/navigation/bottom-sheet/QuickPayPrompt.tsx +++ b/src/navigation/bottom-sheet/QuickPayPrompt.tsx @@ -24,7 +24,7 @@ const imageSrc = require('../../assets/illustrations/fast-forward.png'); const CHECK_DELAY = 3000; // how long user needs to stay on Wallets screen before he will see this prompt -const QuickPayPrompt = ({ enabled }: { enabled: boolean }): ReactElement => { +const QuickPayPrompt = (): ReactElement => { const { t } = useTranslation('settings'); const navigation = useNavigation(); const { spendingBalance } = useBalance(); @@ -48,13 +48,12 @@ const QuickPayPrompt = ({ enabled }: { enabled: boolean }): ReactElement => { // and user on "Wallets" screen for CHECK_DELAY const shouldShowBottomSheet = useMemo(() => { return ( - enabled && !__E2E__ && !anyBottomSheetIsOpen && !quickpayIntroSeen && spendingBalance > 0 ); - }, [enabled, anyBottomSheetIsOpen, quickpayIntroSeen, spendingBalance]); + }, [anyBottomSheetIsOpen, quickpayIntroSeen, spendingBalance]); useEffect(() => { if (!shouldShowBottomSheet) { @@ -105,6 +104,7 @@ const QuickPayPrompt = ({ enabled }: { enabled: boolean }): ReactElement => { /> } image={imageSrc} + showBackButton={false} continueText={t('learn_more')} cancelText={t('later')} testID="QuickPayPrompt" diff --git a/src/navigation/wallet/WalletNavigator.tsx b/src/navigation/wallet/WalletNavigator.tsx index c42e59c48..85d968c35 100644 --- a/src/navigation/wallet/WalletNavigator.tsx +++ b/src/navigation/wallet/WalletNavigator.tsx @@ -3,22 +3,18 @@ import { NativeStackNavigationProp, createNativeStackNavigator, } from '@react-navigation/native-stack'; -import React, { ReactElement, useState } from 'react'; +import React, { ReactElement } from 'react'; import TabBar from '../../components/TabBar'; import { __E2E__ } from '../../constants/env'; import ActivityFiltered from '../../screens/Activity/ActivityFiltered'; import ActivitySavings from '../../screens/Activity/ActivitySavings'; import ActivitySpending from '../../screens/Activity/ActivitySpending'; -import BackupPrompt from '../../screens/Settings/Backup/BackupPrompt'; -import WalletsScreen from '../../screens/Wallets'; -import AppUpdatePrompt from '../bottom-sheet/AppUpdatePrompt'; -import HighBalanceWarning from '../bottom-sheet/HighBalanceWarning'; -import QuickPayPrompt from '../bottom-sheet/QuickPayPrompt'; +import Home from '../../screens/Wallets/Home'; import type { RootStackScreenProps } from '../types'; export type WalletStackParamList = { - Wallets: { onFocus: (focused: boolean) => void } | undefined; + Home: undefined; ActivitySavings: undefined; ActivitySpending: undefined; ActivityFiltered: undefined; @@ -33,34 +29,22 @@ const screenOptions: NativeStackNavigationOptions = { animation: __E2E__ ? 'none' : 'default', }; -const WalletsStack = ({ +const WalletStack = ({ navigation, }: RootStackScreenProps<'Wallet'>): ReactElement => { - const [isWalletsScreenFocused, setIsFocused] = useState(false); - return ( <> - - {(props): ReactElement => ( - - )} - + + {/* TabBar should be visible on all of the above screens */} - - {/* Put these here so they appear above the TabBar (zIndex) */} - {/* Should only ever show when user is on the main wallet screen */} - - - - ); }; -export default WalletsStack; +export default WalletStack; diff --git a/src/screens/Settings/Advanced/index.tsx b/src/screens/Settings/Advanced/index.tsx index c6652ddff..b44c9a80a 100644 --- a/src/screens/Settings/Advanced/index.tsx +++ b/src/screens/Settings/Advanced/index.tsx @@ -160,7 +160,7 @@ const AdvancedSettings = ({ onConfirm={(): void => { dispatch(resetHiddenTodos()); setShowDialog(false); - navigation.popTo('Wallet', { screen: 'Wallets' }); + navigation.popTo('Wallet', { screen: 'Home' }); }} /> diff --git a/src/screens/Transfer/Availability.tsx b/src/screens/Transfer/Availability.tsx index 708b9040d..63412b2ae 100644 --- a/src/screens/Transfer/Availability.tsx +++ b/src/screens/Transfer/Availability.tsx @@ -17,7 +17,7 @@ const Availability = ({ const { t } = useTranslation('lightning'); const onCancel = (): void => { - navigation.popTo('Wallet', { screen: 'Wallets' }); + navigation.popTo('Wallet', { screen: 'Home' }); }; const onContinue = (): void => { diff --git a/src/screens/Transfer/ExternalNode/Success.tsx b/src/screens/Transfer/ExternalNode/Success.tsx index 670839d18..32ae6f6c0 100644 --- a/src/screens/Transfer/ExternalNode/Success.tsx +++ b/src/screens/Transfer/ExternalNode/Success.tsx @@ -14,7 +14,7 @@ const ExternalSuccess = ({ const { t } = useTranslation('lightning'); const onContinue = (): void => { - navigation.popTo('Wallet', { screen: 'Wallets' }); + navigation.popTo('Wallet', { screen: 'Home' }); }; return ( diff --git a/src/screens/Transfer/Funding.tsx b/src/screens/Transfer/Funding.tsx index 429babb5a..2e5425441 100644 --- a/src/screens/Transfer/Funding.tsx +++ b/src/screens/Transfer/Funding.tsx @@ -33,7 +33,7 @@ const Funding = ({ }; const onFund = (): void => { - navigation.popTo('Wallet', { screen: 'Wallets' }); + navigation.popTo('Wallet', { screen: 'Home' }); showBottomSheet('receiveNavigation', { receiveScreen: 'ReceiveAmount' }); }; diff --git a/src/screens/Transfer/Interrupted.tsx b/src/screens/Transfer/Interrupted.tsx index a818ce531..fcbab4737 100644 --- a/src/screens/Transfer/Interrupted.tsx +++ b/src/screens/Transfer/Interrupted.tsx @@ -13,7 +13,7 @@ const Interrupted = ({ const { t } = useTranslation('lightning'); const onContinue = (): void => { - navigation.popTo('Wallet', { screen: 'Wallets' }); + navigation.popTo('Wallet', { screen: 'Home' }); }; return ( diff --git a/src/screens/Transfer/LNURLChannel.tsx b/src/screens/Transfer/LNURLChannel.tsx index 00264e678..849b57616 100644 --- a/src/screens/Transfer/LNURLChannel.tsx +++ b/src/screens/Transfer/LNURLChannel.tsx @@ -50,7 +50,7 @@ const LNURLChannel = ({ }; const onClosePress = (): void => { - navigation.popTo('Wallet', { screen: 'Wallets' }); + navigation.popTo('Wallet', { screen: 'Home' }); }; return ( diff --git a/src/screens/Transfer/SettingUp.tsx b/src/screens/Transfer/SettingUp.tsx index df1bd559e..8d946263f 100644 --- a/src/screens/Transfer/SettingUp.tsx +++ b/src/screens/Transfer/SettingUp.tsx @@ -35,7 +35,7 @@ const SettingUp = ({ }, [lightningSettingUpStep, navigation]); const onClose = (): void => { - navigation.popTo('Wallet', { screen: 'Wallets' }); + navigation.popTo('Wallet', { screen: 'Home' }); }; return ( diff --git a/src/screens/Transfer/Success.tsx b/src/screens/Transfer/Success.tsx index aa1958d96..eab94bdf4 100644 --- a/src/screens/Transfer/Success.tsx +++ b/src/screens/Transfer/Success.tsx @@ -16,7 +16,7 @@ const Success = ({ const { type } = route.params; const onContinue = (): void => { - navigation.popTo('Wallet', { screen: 'Wallets' }); + navigation.popTo('Wallet', { screen: 'Home' }); }; const isTransferToSavings = type === 'savings'; diff --git a/src/screens/Wallets/Header.tsx b/src/screens/Wallets/Header.tsx index 698ecd022..ce2211988 100644 --- a/src/screens/Wallets/Header.tsx +++ b/src/screens/Wallets/Header.tsx @@ -1,7 +1,7 @@ import { useNavigation } from '@react-navigation/native'; import React, { memo, ReactElement } from 'react'; import { useTranslation } from 'react-i18next'; -import { StyleSheet, View } from 'react-native'; +import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native'; import ProfileImage from '../../components/ProfileImage'; import VerticalShadow from '../../components/VerticalShadow'; @@ -12,7 +12,7 @@ import { ProfileIcon, SettingsIcon } from '../../styles/icons'; import { Title } from '../../styles/text'; import { truncate } from '../../utils/helpers'; -const Header = (): ReactElement => { +const Header = ({ style }: { style?: StyleProp }): ReactElement => { const navigation = useNavigation(); const { t } = useTranslation('slashtags'); const { url } = useSlashtags(); @@ -31,7 +31,7 @@ const Header = (): ReactElement => { }; return ( - + diff --git a/src/screens/Wallets/index.tsx b/src/screens/Wallets/Home.tsx similarity index 65% rename from src/screens/Wallets/index.tsx rename to src/screens/Wallets/Home.tsx index 002e5b329..214edea8a 100644 --- a/src/screens/Wallets/index.tsx +++ b/src/screens/Wallets/Home.tsx @@ -1,5 +1,4 @@ -import { useFocusEffect } from '@react-navigation/native'; -import React, { memo, ReactElement, useState, useCallback } from 'react'; +import React, { memo, ReactElement, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { StyleSheet, View } from 'react-native'; import { RefreshControl, ScrollView } from 'react-native-gesture-handler'; @@ -14,7 +13,10 @@ import Widgets from '../../components/Widgets'; import useColors from '../../hooks/colors'; import { useAppDispatch, useAppSelector } from '../../hooks/redux'; import { useBalance } from '../../hooks/wallet'; -import type { WalletScreenProps } from '../../navigation/types'; +import AppUpdatePrompt from '../../navigation/bottom-sheet/AppUpdatePrompt'; +import BackupPrompt from '../../navigation/bottom-sheet/BackupPrompt'; +import HighBalanceWarning from '../../navigation/bottom-sheet/HighBalanceWarning'; +import QuickPayPrompt from '../../navigation/bottom-sheet/QuickPayPrompt'; import ActivityListShort from '../../screens/Activity/ActivityListShort'; import { enableSwipeToHideBalanceSelector, @@ -36,11 +38,7 @@ import MainOnboarding from './MainOnboarding'; const HEADER_HEIGHT = 46; -type Props = WalletScreenProps<'Wallets'> & { - onFocus: (isFocused: boolean) => void; -}; - -const Wallets = ({ onFocus }: Props): ReactElement => { +const Home = (): ReactElement => { const [refreshing, setRefreshing] = useState(false); const colors = useColors(); const dispatch = useAppDispatch(); @@ -60,14 +58,6 @@ const Wallets = ({ onFocus }: Props): ReactElement => { const insets = useSafeAreaInsets(); const { t } = useTranslation('wallet'); - // tell WalletNavigator that this screen is focused - useFocusEffect( - useCallback(() => { - onFocus(true); - return (): void => onFocus(false); - }, [onFocus]), - ); - const toggleHideBalance = (): void => { const enabled = !hideBalance; dispatch(updateSettings({ hideBalance: enabled })); @@ -95,50 +85,60 @@ const Wallets = ({ onFocus }: Props): ReactElement => { const hideOnboarding = hideOnboardingSetting || totalBalance > 0; return ( - - - -
- - - }> - - - - - + <> + + + {/* Need this wrapper for Android e2e tests */} + +
+ - {hideOnboarding ? ( - <> - - - - {showWidgets && } - + + }> + + + - - ) : ( - - )} - - + + + {hideOnboarding ? ( + <> + + + + {showWidgets && } + + + + ) : ( + + )} + + + + {/* Timed/conditional bottom-sheets */} + + + + + ); }; @@ -164,4 +164,4 @@ const styles = StyleSheet.create({ }, }); -export default memo(Wallets); +export default memo(Home);