mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-03-13 19:16:52 +01:00
REF: View Edit Multisig navigation
Easier to popTo since its just 1 screen
This commit is contained in:
parent
1a848328e3
commit
136dd20f9e
7 changed files with 29 additions and 72 deletions
|
@ -10,7 +10,7 @@ import { useCallback, useMemo } from 'react';
|
|||
const requiresBiometrics = [
|
||||
'WalletExportRoot',
|
||||
'WalletXpubRoot',
|
||||
'ViewEditMultisigCosignersRoot',
|
||||
'ViewEditMultisigCosigners',
|
||||
'ExportMultisigCoordinationSetupRoot',
|
||||
];
|
||||
|
||||
|
|
|
@ -35,7 +35,6 @@ import ReceiveDetailsStackRoot from './ReceiveDetailsStack';
|
|||
import ScanLndInvoiceRoot from './ScanLndInvoiceStack';
|
||||
import SendDetailsStack from './SendDetailsStack';
|
||||
import SignVerifyStackRoot from './SignVerifyStack';
|
||||
import ViewEditMultisigCosignersStackRoot from './ViewEditMultisigCosignersStack';
|
||||
import WalletExportStack from './WalletExportStack';
|
||||
import WalletXpubStackRoot from './WalletXpubStack';
|
||||
import SettingsButton from '../components/icons/SettingsButton';
|
||||
|
@ -66,6 +65,7 @@ import ToolsScreen from '../screen/settings/tools';
|
|||
import SettingsPrivacy from '../screen/settings/SettingsPrivacy';
|
||||
import { ScanQRCodeComponent } from './LazyLoadScanQRCodeStack';
|
||||
import { useIsLargeScreen } from '../hooks/useIsLargeScreen';
|
||||
import { ViewEditMultisigCosignersComponent } from './LazyLoadViewEditMultisigCosignersStack';
|
||||
|
||||
const DetailViewStackScreensStack = () => {
|
||||
const theme = useTheme();
|
||||
|
@ -342,8 +342,8 @@ const DetailViewStackScreensStack = () => {
|
|||
/>
|
||||
|
||||
<DetailViewStack.Screen
|
||||
name="ViewEditMultisigCosignersRoot"
|
||||
component={ViewEditMultisigCosignersStackRoot}
|
||||
name="ViewEditMultisigCosigners"
|
||||
component={ViewEditMultisigCosignersComponent}
|
||||
options={{ ...NavigationDefaultOptions, ...StatusBarLightOptions, gestureEnabled: false, fullScreenGestureEnabled: false }}
|
||||
initialParams={{ walletID: undefined, cosigners: undefined }}
|
||||
/>
|
||||
|
|
|
@ -79,7 +79,7 @@ export type DetailViewStackParamList = {
|
|||
ReleaseNotes: undefined;
|
||||
ToolsScreen: undefined;
|
||||
SettingsPrivacy: undefined;
|
||||
ViewEditMultisigCosignersRoot: { walletID: string; cosigners: string[] };
|
||||
ViewEditMultisigCosigners: { walletID: string; cosigners: string[]; onBarScanned?: string };
|
||||
WalletXpubRoot: undefined;
|
||||
SignVerifyRoot: {
|
||||
screen: 'SignVerify';
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
||||
import React from 'react';
|
||||
|
||||
import navigationStyle from '../components/navigationStyle';
|
||||
import { useTheme } from '../components/themes';
|
||||
import loc from '../loc';
|
||||
import { ViewEditMultisigCosignersComponent } from './LazyLoadViewEditMultisigCosignersStack';
|
||||
import { ScanQRCodeComponent } from './LazyLoadScanQRCodeStack';
|
||||
import { ScanQRCodeParamList } from './DetailViewStackParamList';
|
||||
|
||||
export type ViewEditMultisigCosignersStackParamList = {
|
||||
ViewEditMultisigCosigners: {
|
||||
walletID: string;
|
||||
onBarScanned?: string;
|
||||
};
|
||||
ScanQRCode: ScanQRCodeParamList;
|
||||
};
|
||||
|
||||
const Stack = createNativeStackNavigator<ViewEditMultisigCosignersStackParamList>();
|
||||
|
||||
const ViewEditMultisigCosignersStackRoot = () => {
|
||||
const theme = useTheme();
|
||||
|
||||
return (
|
||||
<Stack.Navigator screenOptions={{ headerShadowVisible: false }}>
|
||||
<Stack.Screen
|
||||
name="ViewEditMultisigCosigners"
|
||||
component={ViewEditMultisigCosignersComponent}
|
||||
options={navigationStyle({
|
||||
headerBackVisible: false,
|
||||
title: loc.multisig.manage_keys,
|
||||
})(theme)}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="ScanQRCode"
|
||||
component={ScanQRCodeComponent}
|
||||
options={navigationStyle({
|
||||
headerShown: false,
|
||||
statusBarHidden: true,
|
||||
presentation: 'fullScreenModal',
|
||||
headerShadowVisible: false,
|
||||
})(theme)}
|
||||
/>
|
||||
</Stack.Navigator>
|
||||
);
|
||||
};
|
||||
|
||||
export default ViewEditMultisigCosignersStackRoot;
|
|
@ -1,5 +1,5 @@
|
|||
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { RouteProp, useFocusEffect, useRoute, usePreventRemove, CommonActions } from '@react-navigation/native';
|
||||
import { RouteProp, useFocusEffect, useRoute, usePreventRemove, StackActions } from '@react-navigation/native';
|
||||
import {
|
||||
ActivityIndicator,
|
||||
Alert,
|
||||
|
@ -18,7 +18,15 @@ import {
|
|||
import { Badge, Icon } from '@rneui/themed';
|
||||
import { isDesktop } from '../../blue_modules/environment';
|
||||
import { encodeUR } from '../../blue_modules/ur';
|
||||
import { BlueCard, BlueFormMultiInput, BlueLoading, BlueSpacing10, BlueSpacing20, BlueTextCentered } from '../../BlueComponents';
|
||||
import {
|
||||
BlueCard,
|
||||
BlueFormMultiInput,
|
||||
BlueLoading,
|
||||
BlueSpacing10,
|
||||
BlueSpacing20,
|
||||
BlueSpacing40,
|
||||
BlueTextCentered,
|
||||
} from '../../BlueComponents';
|
||||
import { HDSegwitBech32Wallet, MultisigCosigner, MultisigHDWallet } from '../../class';
|
||||
import presentAlert from '../../components/Alert';
|
||||
import BottomModal, { BottomModalHandle } from '../../components/BottomModal';
|
||||
|
@ -40,14 +48,14 @@ import { useStorage } from '../../hooks/context/useStorage';
|
|||
import ToolTipMenu from '../../components/TooltipMenu';
|
||||
import { CommonToolTipActions } from '../../typings/CommonToolTipActions';
|
||||
import { useSettings } from '../../hooks/context/useSettings';
|
||||
import { ViewEditMultisigCosignersStackParamList } from '../../navigation/ViewEditMultisigCosignersStack';
|
||||
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
|
||||
import SafeArea from '../../components/SafeArea';
|
||||
import { TWallet } from '../../class/wallets/types';
|
||||
import { AddressInputScanButton } from '../../components/AddressInputScanButton';
|
||||
import { DetailViewStackParamList } from '../../navigation/DetailViewStackParamList';
|
||||
|
||||
type RouteParams = RouteProp<ViewEditMultisigCosignersStackParamList, 'ViewEditMultisigCosigners'>;
|
||||
type NavigationProp = NativeStackNavigationProp<ViewEditMultisigCosignersStackParamList, 'ViewEditMultisigCosigners'>;
|
||||
type RouteParams = RouteProp<DetailViewStackParamList, 'ViewEditMultisigCosigners'>;
|
||||
type NavigationProp = NativeStackNavigationProp<DetailViewStackParamList, 'ViewEditMultisigCosigners'>;
|
||||
|
||||
const ViewEditMultisigCosigners: React.FC = () => {
|
||||
const hasLoaded = useRef(false);
|
||||
|
@ -169,9 +177,11 @@ const ViewEditMultisigCosigners: React.FC = () => {
|
|||
setIsSaveButtonDisabled(true);
|
||||
setWalletsWithNewOrder(newWallets);
|
||||
setTimeout(() => {
|
||||
dispatch(
|
||||
CommonActions.navigate({ name: 'WalletTransactions', params: { walletID: wallet.getID(), walletType: MultisigHDWallet.type } }),
|
||||
);
|
||||
const popTo = StackActions.popTo('WalletTransactions', {
|
||||
walletID,
|
||||
walletType: wallet.type,
|
||||
});
|
||||
dispatch(popTo);
|
||||
}, 500);
|
||||
}, 100);
|
||||
};
|
||||
|
@ -560,6 +570,7 @@ const ViewEditMultisigCosigners: React.FC = () => {
|
|||
|
||||
{!isLoading && (
|
||||
<>
|
||||
<BlueSpacing40 />
|
||||
<AddressInputScanButton
|
||||
beforePress={async () => {
|
||||
await provideMnemonicsModalRef.current?.dismiss();
|
||||
|
@ -568,7 +579,7 @@ const ViewEditMultisigCosigners: React.FC = () => {
|
|||
type="link"
|
||||
onChangeText={setImportText}
|
||||
/>
|
||||
<BlueSpacing20 />
|
||||
<BlueSpacing40 />
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
|
|
|
@ -305,11 +305,8 @@ const WalletDetails: React.FC = () => {
|
|||
});
|
||||
};
|
||||
const navigateToViewEditCosigners = () => {
|
||||
navigate('ViewEditMultisigCosignersRoot', {
|
||||
screen: 'ViewEditMultisigCosigners',
|
||||
params: {
|
||||
walletID,
|
||||
},
|
||||
navigate('ViewEditMultisigCosigners', {
|
||||
walletID,
|
||||
});
|
||||
};
|
||||
const navigateToXPub = () =>
|
||||
|
|
|
@ -256,11 +256,8 @@ const WalletTransactions: React.FC<WalletTransactionsProps> = ({ route }) => {
|
|||
);
|
||||
|
||||
const navigateToViewEditCosigners = useCallback(() => {
|
||||
navigate('ViewEditMultisigCosignersRoot', {
|
||||
screen: 'ViewEditMultisigCosigners',
|
||||
params: {
|
||||
walletID,
|
||||
},
|
||||
navigate('ViewEditMultisigCosigners', {
|
||||
walletID,
|
||||
});
|
||||
}, [navigate, walletID]);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue