import { DrawerNavigationOptions, createDrawerNavigator } from '@react-navigation/drawer'; import { NativeStackNavigationOptions, createNativeStackNavigator } from '@react-navigation/native-stack'; import React, { useContext, useMemo } from 'react'; import { I18nManager, Platform, TouchableOpacity } from 'react-native'; import AddWalletStack from './navigation/AddWalletStack'; import { StackActions } from '@react-navigation/native'; import WalletAddresses from './screen/wallets/addresses'; import WalletDetails from './screen/wallets/details'; import GenerateWord from './screen/wallets/generateWord'; import WalletsList from './screen/wallets/WalletsList'; import SelectWallet from './screen/wallets/selectWallet'; import WalletTransactions from './screen/wallets/transactions'; import CPFP from './screen/transactions/CPFP'; import RBFBumpFee from './screen/transactions/RBFBumpFee'; import RBFCancel from './screen/transactions/RBFCancel'; import TransactionDetails from './screen/transactions/details'; import TransactionStatus from './screen/transactions/TransactionStatus'; import Broadcast from './screen/send/Broadcast'; import IsItMyAddress from './screen/send/isItMyAddress'; import Success from './screen/send/success'; import UnlockWith from './screen/UnlockWith'; import { isDesktop, isHandset } from './blue_modules/environment'; import navigationStyle from './components/navigationStyle'; import { useTheme } from './components/themes'; import loc from './loc'; import LdkInfo from './screen/lnd/ldkInfo'; import LNDViewAdditionalInvoiceInformation from './screen/lnd/lndViewAdditionalInvoiceInformation'; import LNDViewAdditionalInvoicePreImage from './screen/lnd/lndViewAdditionalInvoicePreImage'; import LNDViewInvoice from './screen/lnd/lndViewInvoice'; import LnurlAuth from './screen/lnd/lnurlAuth'; import LnurlPay from './screen/lnd/lnurlPay'; import LnurlPaySuccess from './screen/lnd/lnurlPaySuccess'; import DrawerList from './screen/wallets/DrawerList'; import LdkViewLogs from './screen/wallets/ldkViewLogs'; import { BlueStorageContext } from './blue_modules/storage-context'; import { useIsLargeScreen } from './hooks/useIsLargeScreen'; import HeaderRightButton from './components/HeaderRightButton'; import WalletExportStack from './navigation/WalletExportStack'; import SendDetailsStack from './navigation/SendDetailsStack'; import LNDCreateInvoiceRoot from './navigation/LNDCreateInvoiceStack'; import ReceiveDetailsStackRoot from './navigation/ReceiveDetailsStack'; import ScanLndInvoiceRoot from './navigation/ScanLndInvoiceStack'; import { useExtendedNavigation } from './hooks/useExtendedNavigation'; import ReorderWalletsStackRoot from './navigation/ReorderWalletsStack'; import WalletXpubStackRoot from './navigation/WalletXpubStack'; import ScanQRCodeStackRoot from './navigation/ScanQRCodeStack'; import ExportMultisigCoordinationSetupStackRoot from './navigation/ExportMultisigCoordinationSetupStack'; import ViewEditMultisigCosignersStackRoot from './navigation/ViewEditMultisigCosignersStack'; import SignVerifyStackRoot from './navigation/SignVerifyStack'; import AztecoRedeemStackRoot from './navigation/AztecoRedeemStack'; import LDKOpenChannelRoot from './navigation/LDKOpenChannelStack'; import PaymentCodeStackRoot from './navigation/PaymentCodeStack'; import { AboutComponent, CurrencyComponent, DefaultViewComponent, ElectrumSettingsComponent, EncryptStorageComponent, GeneralSettingsComponent, LanguageComponent, LicensingComponent, LightningSettingsComponent, NetworkSettingsComponent, NotificationSettingsComponent, PlausibleDeniabilityComponent, ReleaseNotesComponent, SelftestComponent, SettingsComponent, SettingsPrivacyComponent, ToolsComponent, } from './navigation/LazyLoadSettingsStack'; import { Icon } from 'react-native-elements'; export const NavigationDefaultOptions: NativeStackNavigationOptions = { headerShown: false, presentation: 'modal', headerShadowVisible: false, }; export const NavigationFormModalOptions: NativeStackNavigationOptions = { headerShown: false, presentation: 'formSheet', }; export const NavigationDefaultOptionsForDesktop: NativeStackNavigationOptions = { headerShown: false, presentation: 'fullScreenModal' }; export const StatusBarLightOptions: NativeStackNavigationOptions = { statusBarStyle: 'light' }; const DrawerListContent = (props: any) => { return ; }; const Drawer = createDrawerNavigator(); const DrawerRoot = () => { const isLargeScreen = useIsLargeScreen(); const drawerStyle: DrawerNavigationOptions = useMemo( () => ({ drawerPosition: I18nManager.isRTL ? 'right' : 'left', drawerStyle: { width: isLargeScreen ? 320 : '0%' }, drawerType: isLargeScreen ? 'permanent' : 'back', }), [isLargeScreen], ); return ( ); }; const DetailViewRoot = createNativeStackNavigator(); const DetailViewStackScreensStack = () => { const { walletsInitialized } = useContext(BlueStorageContext); const theme = useTheme(); const navigation = useExtendedNavigation(); const popToTop = () => { navigation.dispatch(StackActions.popToTop()); }; const SaveButton = useMemo(() => , []); const useWalletListScreenOptions = useMemo(() => { const SettingsButton = ( navigation.navigate('Settings')} > ); return { title: '', headerBackTitle: loc.wallets.list_title, navigationBarColor: theme.colors.navigationBarColor, headerShown: true, headerStyle: { backgroundColor: theme.colors.customHeader, }, headerRight: I18nManager.isRTL ? undefined : () => SettingsButton, headerLeft: I18nManager.isRTL ? () => SettingsButton : undefined, }; }, [navigation, theme.colors.customHeader, theme.colors.foregroundColor, theme.colors.navigationBarColor]); const walletListScreenOptions = useWalletListScreenOptions; return ( {!walletsInitialized ? ( ) : ( SaveButton, })(theme)} /> SaveButton, })(theme)} /> {/* screens */} )} ); }; const MainRoot = () => { return isHandset ? : ; }; export default MainRoot;