Skip to content

Commit b1b4156

Browse files
committed
fix(widgets): #2448 refresh calculator widget when currency changes
1 parent fe0b35d commit b1b4156

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/components/widgets/CalculatorWidget.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { ReactElement, useState } from 'react';
1+
import React, { ReactElement, useEffect, useState } from 'react';
22
import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native';
33

44
import { useCurrency } from '../../hooks/displayValues';
@@ -30,6 +30,11 @@ const CalculatorWidget = ({
3030
return dv.fiatValue.toString();
3131
});
3232

33+
// biome-ignore lint/correctness/useExhaustiveDependencies: update fiat amount when currency changes
34+
useEffect(() => {
35+
updateFiatAmount(bitcoinAmount);
36+
}, [fiatTicker]);
37+
3338
const updateFiatAmount = (bitcoin: string) => {
3439
const amount = Number(bitcoin);
3540
const dv = getDisplayValues({ satoshis: amount, shouldRoundUpFiat: true });

0 commit comments

Comments
 (0)