mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-01-18 21:35:21 +01:00
FIX: Bug: open a wallet with a hidden balance then show #7383
This commit is contained in:
parent
9ba2852057
commit
df8c9793d8
@ -22,13 +22,13 @@ interface TransactionsNavigationHeaderProps {
|
||||
}
|
||||
|
||||
const TransactionsNavigationHeader: React.FC<TransactionsNavigationHeaderProps> = ({
|
||||
wallet: initialWallet,
|
||||
wallet,
|
||||
onWalletUnitChange,
|
||||
onManageFundsPressed,
|
||||
onWalletBalanceVisibilityChange,
|
||||
unit = BitcoinUnit.BTC,
|
||||
}) => {
|
||||
const [wallet, setWallet] = useState(initialWallet);
|
||||
const { hideBalance } = wallet;
|
||||
const [allowOnchainAddress, setAllowOnchainAddress] = useState(false);
|
||||
const { preferredFiatCurrency } = useSettings();
|
||||
|
||||
@ -44,10 +44,6 @@ const TransactionsNavigationHeader: React.FC<TransactionsNavigationHeaderProps>
|
||||
}
|
||||
}, [wallet]);
|
||||
|
||||
useEffect(() => {
|
||||
setWallet(initialWallet);
|
||||
}, [initialWallet]);
|
||||
|
||||
useEffect(() => {
|
||||
verifyIfWalletAllowsOnchainAddress();
|
||||
}, [wallet, verifyIfWalletAllowsOnchainAddress]);
|
||||
@ -60,8 +56,8 @@ const TransactionsNavigationHeader: React.FC<TransactionsNavigationHeaderProps>
|
||||
}, [unit, wallet]);
|
||||
|
||||
const handleBalanceVisibility = useCallback(() => {
|
||||
onWalletBalanceVisibilityChange?.(!wallet.hideBalance);
|
||||
}, [onWalletBalanceVisibilityChange, wallet.hideBalance]);
|
||||
onWalletBalanceVisibilityChange?.(!hideBalance);
|
||||
}, [onWalletBalanceVisibilityChange, hideBalance]);
|
||||
|
||||
const changeWalletBalanceUnit = () => {
|
||||
let newWalletPreferredUnit = wallet.getPreferredBalanceUnit();
|
||||
@ -113,16 +109,15 @@ const TransactionsNavigationHeader: React.FC<TransactionsNavigationHeaderProps>
|
||||
}, []);
|
||||
|
||||
const balance = useMemo(() => {
|
||||
const hideBalance = wallet.hideBalance;
|
||||
const balanceFormatted =
|
||||
unit === BitcoinUnit.LOCAL_CURRENCY
|
||||
? formatBalance(wallet.getBalance(), unit, true)
|
||||
: formatBalanceWithoutSuffix(wallet.getBalance(), unit, true);
|
||||
return !hideBalance && balanceFormatted;
|
||||
}, [unit, wallet]);
|
||||
}, [unit, wallet, hideBalance]);
|
||||
|
||||
const toolTipWalletBalanceActions = useMemo(() => {
|
||||
return wallet.hideBalance
|
||||
return hideBalance
|
||||
? [
|
||||
{
|
||||
id: 'walletBalanceVisibility',
|
||||
@ -148,7 +143,7 @@ const TransactionsNavigationHeader: React.FC<TransactionsNavigationHeaderProps>
|
||||
},
|
||||
},
|
||||
];
|
||||
}, [wallet.hideBalance]);
|
||||
}, [hideBalance]);
|
||||
|
||||
const imageSource = useMemo(() => {
|
||||
switch (wallet.type) {
|
||||
@ -162,7 +157,7 @@ const TransactionsNavigationHeader: React.FC<TransactionsNavigationHeaderProps>
|
||||
}, [wallet.type]);
|
||||
|
||||
useAnimateOnChange(balance);
|
||||
useAnimateOnChange(wallet.hideBalance);
|
||||
useAnimateOnChange(hideBalance);
|
||||
useAnimateOnChange(unit);
|
||||
useAnimateOnChange(wallet.getID?.());
|
||||
|
||||
@ -187,7 +182,7 @@ const TransactionsNavigationHeader: React.FC<TransactionsNavigationHeaderProps>
|
||||
actions={toolTipWalletBalanceActions}
|
||||
>
|
||||
<View style={styles.walletBalance}>
|
||||
{wallet.hideBalance ? (
|
||||
{hideBalance ? (
|
||||
<BlurredBalanceView />
|
||||
) : (
|
||||
<View>
|
||||
|
Loading…
Reference in New Issue
Block a user