mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-03-12 18:51:21 +01:00
Update components/TransactionsNavigationHeader.tsx
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
parent
d9f4ad6d39
commit
01dd629c17
1 changed files with 16 additions and 8 deletions
|
@ -160,14 +160,22 @@ const TransactionsNavigationHeader: React.FC<TransactionsNavigationHeaderProps>
|
||||||
}
|
}
|
||||||
}, [wallet.type]);
|
}, [wallet.type]);
|
||||||
|
|
||||||
// Custom hook to store previous value
|
// Custom hook to store previous value
|
||||||
const usePrevious = (value: any) => {
|
const usePrevious = <T>(value: T): T | undefined => {
|
||||||
const ref = useRef();
|
const ref = useRef<T>();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
ref.current = value;
|
ref.current = value;
|
||||||
}, [value]);
|
}, [value]);
|
||||||
return ref.current;
|
return ref.current;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const TransactionsNavigationHeader: React.FC<TransactionsNavigationHeaderProps> = ({
|
||||||
|
wallet: initialWallet,
|
||||||
|
onWalletUnitChange,
|
||||||
|
onManageFundsPressed,
|
||||||
|
onWalletBalanceVisibilityChange,
|
||||||
|
unit = BitcoinUnit.BTC,
|
||||||
|
}) => {
|
||||||
|
|
||||||
// Use previous values to determine if updates have occurred
|
// Use previous values to determine if updates have occurred
|
||||||
const prevBalance = usePrevious(balance);
|
const prevBalance = usePrevious(balance);
|
||||||
|
|
Loading…
Add table
Reference in a new issue