Skip to content

Commit

Permalink
Fixes fee re-calculation on amount change (#218)
Browse files Browse the repository at this point in the history
* fix re-estimating fee

* Add "satoshi" to amount selection
  • Loading branch information
KKA11010 authored Sep 14, 2023
1 parent 5bc508b commit e9e7257
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/screens/Payment/SelectAmount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ export default function SelectAmountScreen({ navigation, route }: TSelectAmountP
// check if is melting process
useEffect(() => setShouldEstimate(!isSendEcash), [isSendEcash])

// estimate fee each time the melt amount changes
// estimate fee each time the melt or swap amount changes
useEffect(() => {
if (!isMelt || !isSwap) { return }
if (isSendEcash) { return }
setFee({ estimation: 0, isCalculating: false })
setShouldEstimate(true)
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand Down Expand Up @@ -191,6 +191,7 @@ export default function SelectAmountScreen({ navigation, route }: TSelectAmountP
maxLength={8}
/>
</Animated.View>
<Txt txt='Satoshi' styles={[{ color: color.TEXT_SECONDARY, fontSize: 14, textAlign: 'center' }]} />
{(isMelt || isSwap || isSendEcash) &&
<Separator style={[{ marginVertical: 20 }]} />
}
Expand Down Expand Up @@ -256,6 +257,7 @@ interface IMeltOverviewProps {
export function MeltOverview({ amount, balance, shouldEstimate, balTooLow, isInvoice, fee }: IMeltOverviewProps) {
const { t } = useTranslation([NS.common])
const { color } = useThemeContext()
l({ fee })
return (
<>
<View style={styles.overview}>
Expand Down

0 comments on commit e9e7257

Please sign in to comment.