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]);
|
||||
|
||||
// Custom hook to store previous value
|
||||
const usePrevious = (value: any) => {
|
||||
const ref = useRef();
|
||||
useEffect(() => {
|
||||
ref.current = value;
|
||||
}, [value]);
|
||||
return ref.current;
|
||||
};
|
||||
// Custom hook to store previous value
|
||||
const usePrevious = <T>(value: T): T | undefined => {
|
||||
const ref = useRef<T>();
|
||||
useEffect(() => {
|
||||
ref.current = value;
|
||||
}, [value]);
|
||||
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
|
||||
const prevBalance = usePrevious(balance);
|
||||
|
|
Loading…
Add table
Reference in a new issue