mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-03-04 12:18:10 +01:00
ADD: useExtendedNavigation Generics
This commit is contained in:
parent
294fa4e930
commit
6cc7fbf0ab
1 changed files with 6 additions and 4 deletions
|
@ -5,15 +5,13 @@ import { presentWalletExportReminder } from '../helpers/presentWalletExportRemin
|
||||||
import { useBiometrics } from './useBiometrics';
|
import { useBiometrics } from './useBiometrics';
|
||||||
|
|
||||||
// List of screens that require biometrics
|
// List of screens that require biometrics
|
||||||
|
|
||||||
const requiresBiometrics = ['WalletExportRoot', 'WalletXpubRoot', 'ViewEditMultisigCosignersRoot', 'ExportMultisigCoordinationSetupRoot'];
|
const requiresBiometrics = ['WalletExportRoot', 'WalletXpubRoot', 'ViewEditMultisigCosignersRoot', 'ExportMultisigCoordinationSetupRoot'];
|
||||||
|
|
||||||
// List of screens that require wallet export to be saved
|
// List of screens that require wallet export to be saved
|
||||||
|
|
||||||
const requiresWalletExportIsSaved = ['ReceiveDetailsRoot', 'WalletAddresses'];
|
const requiresWalletExportIsSaved = ['ReceiveDetailsRoot', 'WalletAddresses'];
|
||||||
|
|
||||||
export const useExtendedNavigation = (): NavigationProp<ParamListBase> => {
|
export const useExtendedNavigation = <T extends NavigationProp<ParamListBase>>(): T => {
|
||||||
const originalNavigation = useNavigation<NavigationProp<ParamListBase>>();
|
const originalNavigation = useNavigation<T>();
|
||||||
const { wallets, saveToDisk } = useStorage();
|
const { wallets, saveToDisk } = useStorage();
|
||||||
const { isBiometricUseEnabled, unlockWithBiometrics } = useBiometrics();
|
const { isBiometricUseEnabled, unlockWithBiometrics } = useBiometrics();
|
||||||
|
|
||||||
|
@ -95,3 +93,7 @@ export const useExtendedNavigation = (): NavigationProp<ParamListBase> => {
|
||||||
navigate: enhancedNavigate,
|
navigate: enhancedNavigate,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Usage example:
|
||||||
|
// type NavigationProps = NativeStackNavigationProp<SendDetailsStackParamList, 'SendDetails'>;
|
||||||
|
// const navigation = useExtendedNavigation<NavigationProps>();
|
||||||
|
|
Loading…
Add table
Reference in a new issue