mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-03-26 08:55:56 +01:00
wip
This commit is contained in:
parent
115ac98172
commit
c43103cb71
2 changed files with 16 additions and 15 deletions
|
@ -4,7 +4,7 @@ import { presentWalletExportReminder } from '../helpers/presentWalletExportRemin
|
|||
import { unlockWithBiometrics, useBiometrics } from './useBiometrics';
|
||||
import { useStorage } from './context/useStorage';
|
||||
import { requestCameraAuthorization } from '../helpers/scan-qr';
|
||||
import { useCallback } from 'react';
|
||||
import { useCallback, useMemo } from 'react';
|
||||
|
||||
// List of screens that require biometrics
|
||||
const requiresBiometrics = ['WalletExportRoot', 'WalletXpubRoot', 'ViewEditMultisigCosignersRoot', 'ExportMultisigCoordinationSetupRoot'];
|
||||
|
@ -96,18 +96,21 @@ export const useExtendedNavigation = <T extends NavigationProp<ParamListBase>>()
|
|||
proceedWithNavigation();
|
||||
})();
|
||||
},
|
||||
[originalNavigation, isBiometricUseEnabled, wallets, saveToDisk]
|
||||
[originalNavigation, isBiometricUseEnabled, wallets, saveToDisk],
|
||||
);
|
||||
|
||||
const navigateToWalletsList = () => {
|
||||
const navigateToWalletsList = useCallback(() => {
|
||||
enhancedNavigate('WalletsList');
|
||||
}
|
||||
}, [enhancedNavigate]);
|
||||
|
||||
return {
|
||||
...originalNavigation,
|
||||
navigate: enhancedNavigate,
|
||||
navigateToWalletsList,
|
||||
};
|
||||
return useMemo(
|
||||
() => ({
|
||||
...originalNavigation,
|
||||
navigate: enhancedNavigate,
|
||||
navigateToWalletsList,
|
||||
}),
|
||||
[originalNavigation, enhancedNavigate, navigateToWalletsList],
|
||||
);
|
||||
};
|
||||
|
||||
// Usage example:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { RouteProp, useNavigation, useRoute } from '@react-navigation/native';
|
||||
import { RouteProp, useRoute } from '@react-navigation/native';
|
||||
import { ActivityIndicator, FlatList, LayoutAnimation, Platform, StyleSheet, UIManager, View } from 'react-native';
|
||||
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
|
||||
import { BlueButtonLink, BlueFormLabel, BlueSpacing10, BlueSpacing20, BlueSpacing40, BlueText } from '../../BlueComponents';
|
||||
|
@ -19,6 +19,7 @@ import { THDWalletForWatchOnly, TWallet } from '../../class/wallets/types';
|
|||
import { keepAwake, disallowScreenshot } from 'react-native-screen-capture';
|
||||
import { useSettings } from '../../hooks/context/useSettings';
|
||||
import { isDesktop } from '../../blue_modules/environment';
|
||||
import { useExtendedNavigation } from '../../hooks/useExtendedNavigation';
|
||||
|
||||
type RouteProps = RouteProp<AddWalletStackParamList, 'ImportWalletDiscovery'>;
|
||||
type NavigationProp = NativeStackNavigationProp<AddWalletStackParamList, 'ImportWalletDiscovery'>;
|
||||
|
@ -34,7 +35,7 @@ if (Platform.OS === 'android' && UIManager.setLayoutAnimationEnabledExperimental
|
|||
}
|
||||
|
||||
const ImportWalletDiscovery: React.FC = () => {
|
||||
const navigation = useNavigation<NavigationProp>();
|
||||
const navigation = useExtendedNavigation<NavigationProp>();
|
||||
const { colors } = useTheme();
|
||||
const route = useRoute<RouteProps>();
|
||||
const { importText, askPassphrase, searchAccounts } = route.params;
|
||||
|
@ -140,10 +141,7 @@ const ImportWalletDiscovery: React.FC = () => {
|
|||
if (!isDesktop) keepAwake(false);
|
||||
task.current?.stop();
|
||||
};
|
||||
// ignoring "navigation" here, because it is constantly mutating
|
||||
// removed all deps as they were leading to a rerender and retask loop
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [askPassphrase, importText, isElectrumDisabled, saveWallet, searchAccounts]);
|
||||
}, [askPassphrase, importText, isElectrumDisabled, navigation, saveWallet, searchAccounts]);
|
||||
|
||||
const handleCustomDerivation = () => {
|
||||
task.current?.stop();
|
||||
|
|
Loading…
Add table
Reference in a new issue